mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
Make ncat -i not timeout while waiting for initial connection
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o [Ncat] Made -i/--idle-timeout not cause Ncat in server mode to close while
|
||||
waiting for an initial connection. This was also causing -i to interfere with
|
||||
the HTTP proxy server mode. [Carlos Manso, Daniel Miller]
|
||||
|
||||
o [NSE][GH#766] The HTTP Host header will now include the port unless it is
|
||||
the default one for a given scheme. [nnposter]
|
||||
|
||||
|
||||
@@ -344,7 +344,10 @@ static int ncat_listen_stream(int proto)
|
||||
if (o.idletimeout > 0)
|
||||
ms_to_timeval(tvp, o.idletimeout);
|
||||
|
||||
fds_ready = fselect(client_fdlist.fdmax + 1, &readfds, &writefds, NULL, tvp);
|
||||
if (get_conn_count())
|
||||
fds_ready = fselect(client_fdlist.fdmax + 1, &readfds, &writefds, NULL, tvp);
|
||||
else
|
||||
fds_ready = fselect(client_fdlist.fdmax + 1, &readfds, &writefds, NULL, NULL);
|
||||
|
||||
if (o.debug > 1)
|
||||
logdebug("select returned %d fds ready\n", fds_ready);
|
||||
@@ -806,7 +809,10 @@ static int ncat_listen_dgram(int proto)
|
||||
if (o.idletimeout > 0)
|
||||
ms_to_timeval(tvp, o.idletimeout);
|
||||
|
||||
fds_ready = fselect(listen_fdlist.fdmax + 1, &fds, NULL, NULL, tvp);
|
||||
if (get_conn_count())
|
||||
fds_ready = fselect(listen_fdlist.fdmax + 1, &fds, NULL, NULL, tvp);
|
||||
else
|
||||
fds_ready = fselect(listen_fdlist.fdmax + 1, &fds, NULL, NULL, NULL);
|
||||
|
||||
if (o.debug > 1)
|
||||
logdebug("select returned %d fds ready\n", fds_ready);
|
||||
|
||||
@@ -196,8 +196,6 @@ int ncat_http_server(void)
|
||||
int listen_socket[NUM_LISTEN_ADDRS];
|
||||
socklen_t sslen;
|
||||
union sockaddr_u conn;
|
||||
struct timeval tv;
|
||||
struct timeval *tvp = NULL;
|
||||
unsigned int num_sockets;
|
||||
|
||||
#ifndef WIN32
|
||||
@@ -248,9 +246,6 @@ int ncat_http_server(void)
|
||||
bye("Unable to open any listening sockets.");
|
||||
}
|
||||
|
||||
if (o.idletimeout > 0)
|
||||
tvp = &tv;
|
||||
|
||||
for (;;) {
|
||||
fd_set read_fds;
|
||||
|
||||
@@ -262,10 +257,7 @@ int ncat_http_server(void)
|
||||
logdebug("selecting, fdmax %d\n", listen_fdlist.fdmax);
|
||||
read_fds = listen_fds;
|
||||
|
||||
if (o.idletimeout > 0)
|
||||
ms_to_timeval(tvp, o.idletimeout);
|
||||
|
||||
int fds_ready = fselect(listen_fdlist.fdmax + 1, &read_fds, NULL, NULL, tvp);
|
||||
int fds_ready = fselect(listen_fdlist.fdmax + 1, &read_fds, NULL, NULL, NULL);
|
||||
|
||||
if (o.debug > 1)
|
||||
logdebug("select returned %d fds ready\n", fds_ready);
|
||||
|
||||
Reference in New Issue
Block a user