mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 07:23:03 +01:00
Misc.
This commit is contained in:
parent
963fdc3c08
commit
d90bf91fbd
@ -152,6 +152,7 @@ const char* GDS_HOSTS_FILE = "/etc/gds_hosts.equiv";
|
|||||||
#define INET_RETRY_ERRNO WSAEINPROGRESS
|
#define INET_RETRY_ERRNO WSAEINPROGRESS
|
||||||
#define INET_ADDR_IN_USE WSAEADDRINUSE
|
#define INET_ADDR_IN_USE WSAEADDRINUSE
|
||||||
#define sleep(seconds) Sleep ((seconds) * 1000)
|
#define sleep(seconds) Sleep ((seconds) * 1000)
|
||||||
|
const int NOTASOCKET = WSAENOTSOCK;
|
||||||
|
|
||||||
#else // WIN_NT
|
#else // WIN_NT
|
||||||
|
|
||||||
@ -167,6 +168,7 @@ const char* GDS_HOSTS_FILE = "/etc/gds_hosts.equiv";
|
|||||||
#ifndef INET_RETRY_ERRNO
|
#ifndef INET_RETRY_ERRNO
|
||||||
#define INET_RETRY_ERRNO TRY_AGAIN
|
#define INET_RETRY_ERRNO TRY_AGAIN
|
||||||
#endif
|
#endif
|
||||||
|
const int NOTASOCKET = EBADF;
|
||||||
|
|
||||||
#endif // WIN_NT
|
#endif // WIN_NT
|
||||||
|
|
||||||
@ -409,7 +411,8 @@ static bool port_mutex_inited = false;
|
|||||||
|
|
||||||
#define DEFER_PORT_CLEANUP
|
#define DEFER_PORT_CLEANUP
|
||||||
|
|
||||||
inline void START_PORT_CRITICAL() {
|
inline void START_PORT_CRITICAL()
|
||||||
|
{
|
||||||
if (!port_mutex_inited) {
|
if (!port_mutex_inited) {
|
||||||
port_mutex_inited = true;
|
port_mutex_inited = true;
|
||||||
}
|
}
|
||||||
@ -418,7 +421,8 @@ inline void START_PORT_CRITICAL() {
|
|||||||
THREAD_ENTER();
|
THREAD_ENTER();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void STOP_PORT_CRITICAL() {
|
inline void STOP_PORT_CRITICAL()
|
||||||
|
{
|
||||||
THREAD_EXIT();
|
THREAD_EXIT();
|
||||||
THD_mutex_unlock (&port_mutex);
|
THD_mutex_unlock (&port_mutex);
|
||||||
THREAD_ENTER();
|
THREAD_ENTER();
|
||||||
@ -2645,16 +2649,12 @@ static int select_wait( rem_port* main_port, SLCT * selct)
|
|||||||
if (badSocket || getsockopt((SOCKET) port->port_handle,
|
if (badSocket || getsockopt((SOCKET) port->port_handle,
|
||||||
SOL_SOCKET, SO_LINGER, (SCHAR*) &lngr, &optlen) != 0)
|
SOL_SOCKET, SO_LINGER, (SCHAR*) &lngr, &optlen) != 0)
|
||||||
{
|
{
|
||||||
#ifndef WIN_NT
|
if (badSocket || INET_ERRNO == NOTASOCKET)
|
||||||
if (badSocket || INET_ERRNO == EBADF)
|
|
||||||
#else
|
|
||||||
if (badSocket || INET_ERRNO == WSAENOTSOCK)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// not a socket, strange !
|
// not a socket, strange !
|
||||||
gds__log("INET/select_wait: found \"not a socket\" socket : %u", (SOCKET) port->port_handle);
|
gds__log("INET/select_wait: found \"not a socket\" socket : %u", (SOCKET) port->port_handle);
|
||||||
|
|
||||||
// this will lead to receive() which will broke bad connection
|
// this will lead to receive() which will break bad connection
|
||||||
selct->slct_count = selct->slct_width = 0;
|
selct->slct_count = selct->slct_width = 0;
|
||||||
FD_ZERO(&selct->slct_fdset);
|
FD_ZERO(&selct->slct_fdset);
|
||||||
if (!badSocket)
|
if (!badSocket)
|
||||||
@ -2734,11 +2734,7 @@ static int select_wait( rem_port* main_port, SLCT * selct)
|
|||||||
}
|
}
|
||||||
else if (INTERRUPT_ERROR(inetErrNo))
|
else if (INTERRUPT_ERROR(inetErrNo))
|
||||||
continue;
|
continue;
|
||||||
#ifndef WIN_NT
|
else if (inetErrNo == NOTASOCKET)
|
||||||
else if (inetErrNo == EBADF)
|
|
||||||
#else
|
|
||||||
else if (inetErrNo == WSAENOTSOCK)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
checkPorts = true;
|
checkPorts = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user