Aborting units -> stopping units
This commit is contained in:
@@ -90,7 +90,7 @@ on_headers_complete (http_parser *parser)
|
||||
struct scan_data *scan = parser->data;
|
||||
// We've got this far, this must be an HTTP server
|
||||
g_data.api->unit_set_success (scan->u, true);
|
||||
g_data.api->unit_abort (scan->u);
|
||||
g_data.api->unit_stop (scan->u);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -144,12 +144,12 @@ on_data (void *handle, const void *data, size_t len)
|
||||
if (parser->upgrade)
|
||||
{
|
||||
// We should never get here though because `on_headers_complete'
|
||||
// is called first and ends up aborting the unit.
|
||||
// is called first and ends up stopping the unit.
|
||||
g_data.api->unit_add_info (scan->u, "upgrades to a different protocol");
|
||||
g_data.api->unit_abort (scan->u);
|
||||
g_data.api->unit_stop (scan->u);
|
||||
}
|
||||
else if (n_parsed != len && parser->http_errno != HPE_CB_headers_complete)
|
||||
g_data.api->unit_abort (scan->u);
|
||||
g_data.api->unit_stop (scan->u);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -168,7 +168,7 @@ static struct service g_http_service =
|
||||
.on_data = on_data,
|
||||
.on_eof = on_eof,
|
||||
.on_error = NULL,
|
||||
.on_aborted = NULL
|
||||
.on_stopped = NULL
|
||||
};
|
||||
|
||||
static bool
|
||||
|
||||
@@ -107,7 +107,7 @@ on_irc_message (const struct irc_message *msg, const char *raw, void *user_data)
|
||||
g_data.api->unit_add_info (scan->u, info);
|
||||
free (info);
|
||||
|
||||
g_data.api->unit_abort (scan->u);
|
||||
g_data.api->unit_stop (scan->u);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ static struct service g_irc_service =
|
||||
.on_data = on_data,
|
||||
.on_eof = NULL,
|
||||
.on_error = NULL,
|
||||
.on_aborted = NULL
|
||||
.on_stopped = NULL
|
||||
};
|
||||
|
||||
static bool
|
||||
|
||||
@@ -110,10 +110,10 @@ xlua_unit_add_info (lua_State *L)
|
||||
}
|
||||
|
||||
static int
|
||||
xlua_unit_abort (lua_State *L)
|
||||
xlua_unit_stop (lua_State *L)
|
||||
{
|
||||
struct unit_wrapper *data = luaL_checkudata (L, 1, UNIT_METATABLE);
|
||||
g_data.api->unit_abort (data->unit);
|
||||
g_data.api->unit_stop (data->unit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ static luaL_Reg xlua_unit_table[] =
|
||||
{ "write", xlua_unit_write },
|
||||
{ "set_success", xlua_unit_set_success },
|
||||
{ "add_info", xlua_unit_add_info },
|
||||
{ "abort", xlua_unit_abort },
|
||||
{ "stop", xlua_unit_stop },
|
||||
{ "__gc", xlua_unit_destroy },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
@@ -208,7 +208,7 @@ handle_scan_method_failure (struct scan_data *data)
|
||||
{
|
||||
print_error ("Lua: service `%s': %s", data->service->name,
|
||||
lua_tostring (data->L, -1));
|
||||
g_data.api->unit_abort (data->unit);
|
||||
g_data.api->unit_stop (data->unit);
|
||||
lua_pop (data->L, 1);
|
||||
}
|
||||
|
||||
@@ -273,10 +273,10 @@ on_error (void *handle)
|
||||
}
|
||||
|
||||
static void
|
||||
on_aborted (void *handle)
|
||||
on_stopped (void *handle)
|
||||
{
|
||||
struct scan_data *data = handle;
|
||||
if (!prepare_scan_method (data, "on_aborted"))
|
||||
if (!prepare_scan_method (data, "on_stopped"))
|
||||
return;
|
||||
if (lua_pcall (data->L, 1, 0, 0))
|
||||
handle_scan_method_failure (data);
|
||||
@@ -329,7 +329,7 @@ xlua_register_service (lua_State *L)
|
||||
s->on_data = on_data;
|
||||
s->on_eof = on_eof;
|
||||
s->on_error = on_error;
|
||||
s->on_aborted = on_aborted;
|
||||
s->on_stopped = on_stopped;
|
||||
|
||||
g_data.api->register_service (g_data.ctx, s);
|
||||
return 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ function MPD:on_data (data)
|
||||
self.unit:add_info ("version " .. version)
|
||||
self.unit:set_success (true)
|
||||
end
|
||||
self.unit:abort ()
|
||||
self.unit:stop ()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ function Socks4:on_data (data)
|
||||
if null == 0 and code >= 90 and code <= 93 then
|
||||
self.unit:set_success (true)
|
||||
end
|
||||
self.unit:abort ()
|
||||
self.unit:stop ()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ function Socks5:on_data (data)
|
||||
end
|
||||
self.unit:set_success (true)
|
||||
end
|
||||
self.unit:abort ()
|
||||
self.unit:stop ()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ on_data (void *handle, const void *data, size_t len)
|
||||
g_data.api->unit_set_success (scan->u, true);
|
||||
|
||||
end_scan:
|
||||
g_data.api->unit_abort (scan->u);
|
||||
g_data.api->unit_stop (scan->u);
|
||||
}
|
||||
|
||||
static struct service g_ssh_service =
|
||||
@@ -90,7 +90,7 @@ static struct service g_ssh_service =
|
||||
.on_data = on_data,
|
||||
.on_eof = NULL,
|
||||
.on_error = NULL,
|
||||
.on_aborted = NULL
|
||||
.on_stopped = NULL
|
||||
};
|
||||
|
||||
static bool
|
||||
|
||||
Reference in New Issue
Block a user