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

Always delete old IOD before attempting reconnect

Trying to connect on the same IOD was leaking sockets, and may have
contributed to high CPU usage on Windows (See #1688)
This commit is contained in:
dmiller
2019-08-15 18:31:59 +00:00
parent 944963dcdc
commit 862054bf5d

View File

@@ -1227,13 +1227,11 @@ static void connect_handler(nsock_pool nsp, nsock_event evt, void *data)
: socket_strerror(nse_errorcode(evt))); : socket_strerror(nse_errorcode(evt)));
loguser("Trying next address...\n"); loguser("Trying next address...\n");
} }
#ifdef HAVE_OPENSSL /* Delete the old IOD and make a new one for the next address.
/* If it's an SSL reconnect, clear out any old session info */ * This also clears SSL session info. */
if (nsock_iod_check_ssl(cs.sock_nsi)) { nsock_iod_delete(cs.sock_nsi, NSOCK_PENDING_NOTIFY);
nsock_iod_delete(cs.sock_nsi, NSOCK_PENDING_NOTIFY); cs.sock_nsi = new_iod(nsp);
cs.sock_nsi = new_iod(nsp);
}
#endif
try_nsock_connect(nsp, next_addr); try_nsock_connect(nsp, next_addr);
return; return;
} }