inet.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | inet.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 1029 | skipping to change at line 1029 | |||
if (n != 0) // getsockopt failed | if (n != 0) // getsockopt failed | |||
port->port_linger.l_onoff = 0; | port->port_linger.l_onoff = 0; | |||
n = setsockopt(port->port_handle, SOL_SOCKET, SO_LINGER, | n = setsockopt(port->port_handle, SOL_SOCKET, SO_LINGER, | |||
(SCHAR *) & lingerInfo, sizeof(lingerI nfo)); | (SCHAR *) & lingerInfo, sizeof(lingerI nfo)); | |||
if (n == -1) | if (n == -1) | |||
{ | { | |||
inet_error(true, port, "setsockopt LINGER", isc_net_conne ct_listen_err, INET_ERRNO); | inet_error(true, port, "setsockopt LINGER", isc_net_conne ct_listen_err, INET_ERRNO); | |||
} | } | |||
} | ||||
if (! setNoNagleOption(port)) | // RS: In linux sockets inherit this option from listener. Previously CLA | |||
{ | SSIC had no its own listen socket | |||
inet_error(true, port, "setsockopt TCP_NODELAY", isc_net_ | // Now it's necessary to respect the option via listen socket. | |||
connect_listen_err, INET_ERRNO); | if (! setNoNagleOption(port)) | |||
} | { | |||
inet_error(true, port, "setsockopt TCP_NODELAY", isc_net_connect_ | ||||
listen_err, INET_ERRNO); | ||||
} | } | |||
// On Linux platform, when the server dies the system holds a port | // On Linux platform, when the server dies the system holds a port | |||
// for some time (we don't set SO_REUSEADDR for standalone server). | // for some time (we don't set SO_REUSEADDR for standalone server). | |||
int retry = -1; | int retry = -1; | |||
do | do | |||
{ | { | |||
if (++retry) | if (++retry) | |||
sleep(10); | sleep(10); | |||
n = bind(port->port_handle, pai->ai_addr, pai->ai_addrlen); | n = bind(port->port_handle, pai->ai_addr, pai->ai_addrlen); | |||
skipping to change at line 1648 | skipping to change at line 1650 | |||
setsockopt(port->port_handle, SOL_SOCKET, SO_LINGER, | setsockopt(port->port_handle, SOL_SOCKET, SO_LINGER, | |||
(SCHAR*) &port->port_linger, sizeof(port->port _linger)); | (SCHAR*) &port->port_linger, sizeof(port->port _linger)); | |||
} | } | |||
if (port->port_handle != INVALID_SOCKET) | if (port->port_handle != INVALID_SOCKET) | |||
{ | { | |||
shutdown(port->port_handle, 2); | shutdown(port->port_handle, 2); | |||
} | } | |||
MutexLockGuard guard(port_mutex, FB_FUNCTION); | MutexLockGuard guard(port_mutex, FB_FUNCTION); | |||
if (port->port_state == rem_port::DISCONNECTED) | ||||
return; | ||||
port->port_state = rem_port::DISCONNECTED; | port->port_state = rem_port::DISCONNECTED; | |||
port->port_flags &= ~PORT_connecting; | port->port_flags &= ~PORT_connecting; | |||
if (port->port_async) | if (port->port_async) | |||
{ | { | |||
disconnect(port->port_async); | disconnect(port->port_async); | |||
port->port_async = NULL; | port->port_async = NULL; | |||
} | } | |||
port->port_context = NULL; | port->port_context = NULL; | |||
skipping to change at line 1682 | skipping to change at line 1687 | |||
if (port->port_channel != INVALID_SOCKET) | if (port->port_channel != INVALID_SOCKET) | |||
ports_to_close->push(port->port_channel); | ports_to_close->push(port->port_channel); | |||
} | } | |||
else | else | |||
{ | { | |||
SOCLOSE(port->port_handle); | SOCLOSE(port->port_handle); | |||
SOCLOSE(port->port_channel); | SOCLOSE(port->port_channel); | |||
} | } | |||
port->release(); | if (port->port_thread_guard && port->port_events_thread && !Thread::isCur | |||
rent(port->port_events_threadId)) | ||||
port->port_thread_guard->setWait(port->port_events_thread); | ||||
else | ||||
port->release(); | ||||
#ifdef DEBUG | #ifdef DEBUG | |||
if (INET_trace & TRACE_summary) | if (INET_trace & TRACE_summary) | |||
{ | { | |||
fprintf(stdout, "INET_count_send = %u packets\n", INET_count_send ); | fprintf(stdout, "INET_count_send = %u packets\n", INET_count_send ); | |||
fprintf(stdout, "INET_bytes_send = %u bytes\n", INET_bytes_send); | fprintf(stdout, "INET_bytes_send = %u bytes\n", INET_bytes_send); | |||
fprintf(stdout, "INET_count_recv = %u packets\n", INET_count_recv ); | fprintf(stdout, "INET_count_recv = %u packets\n", INET_count_recv ); | |||
fprintf(stdout, "INET_bytes_recv = %u bytes\n", INET_bytes_recv); | fprintf(stdout, "INET_bytes_recv = %u bytes\n", INET_bytes_recv); | |||
fflush(stdout); | fflush(stdout); | |||
} | } | |||
skipping to change at line 2070 | skipping to change at line 2078 | |||
for (port = main_port; port; port = port->port_next) | for (port = main_port; port; port = port->port_next) | |||
{ | { | |||
Select::HandleState result = selct->ok(port); | Select::HandleState result = selct->ok(port); | |||
selct->unset(port->port_handle); | selct->unset(port->port_handle); | |||
switch (result) | switch (result) | |||
{ | { | |||
case Select::SEL_BAD: | case Select::SEL_BAD: | |||
if (port->port_state == rem_port::BROKEN || (port->port_f lags & PORT_connecting)) | if (port->port_state == rem_port::BROKEN || (port->port_f lags & PORT_connecting)) | |||
continue; | continue; | |||
if (port->port_flags & PORT_async) | ||||
continue; | ||||
return; | return; | |||
case Select::SEL_DISCONNECTED: | case Select::SEL_DISCONNECTED: | |||
continue; | continue; | |||
case Select::SEL_READY: | case Select::SEL_READY: | |||
port->port_dummy_timeout = port->port_dummy_packet_interv al; | port->port_dummy_timeout = port->port_dummy_packet_interv al; | |||
return; | return; | |||
default: | default: | |||
skipping to change at line 2850 | skipping to change at line 2860 | |||
} | } | |||
// On Linux systems (and possibly others too) select will eventually | // On Linux systems (and possibly others too) select will eventually | |||
// change timout values so save it here for later reuse. | // change timout values so save it here for later reuse. | |||
// Thanks to Brad Pepers who reported this bug FSG 3 MAY 2001 | // Thanks to Brad Pepers who reported this bug FSG 3 MAY 2001 | |||
const timeval savetime = timeout; | const timeval savetime = timeout; | |||
const SOCKET ph = port->port_handle; | const SOCKET ph = port->port_handle; | |||
if (ph == INVALID_SOCKET) | if (ph == INVALID_SOCKET) | |||
{ | { | |||
if (!(port->port_flags & PORT_disconnect)) | const bool releasePort = (port->port_flags & PORT_server); | |||
if (!(port->port_flags & PORT_disconnect) && releasePort) | ||||
inet_error(true, port, "invalid socket in packet_receive" , isc_net_read_err, EINVAL); | inet_error(true, port, "invalid socket in packet_receive" , isc_net_read_err, EINVAL); | |||
return false; | return false; | |||
} | } | |||
// Unsed to send a dummy packet, but too big to be defined in the loop. | // Unsed to send a dummy packet, but too big to be defined in the loop. | |||
PACKET packet; | PACKET packet; | |||
int n = 0; | int n = 0; | |||
int inetErrNo; | int inetErrNo; | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 20 lines changed or added |