1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Allow a socket created/connected in one thread to be used in another. See #1233

This commit is contained in:
dmiller
2020-02-18 19:41:29 +00:00
parent 36018c07d7
commit aaea7ab4e9

View File

@@ -366,6 +366,16 @@ static void callback (nsock_pool nsp, nsock_event nse, void *ud)
nu->action = "ERROR";
return;
}
switch (nse_type(nse)) {
case NSE_TYPE_CONNECT:
case NSE_TYPE_CONNECT_SSL:
/* After a connect or reconnect event, allow the socket to be reused by a
* different thread. */
nu->thread = NULL;
break;
default:
break;
}
assert(lua_status(L) == LUA_YIELD);
trace(nse_iod(nse), nu->action, nu->direction);
status(L, nse_status(nse));