mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
Merge abelkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-owner2-5.0
This commit is contained in:
commit
c41970ab75
2 changed files with 33 additions and 1 deletions
|
@ -86,6 +86,7 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
|
|||
|
||||
int Ndb_check_socket_hup(NDB_SOCKET_TYPE sock)
|
||||
{
|
||||
#ifdef HAVE_POLL
|
||||
struct pollfd pfd[1];
|
||||
int r;
|
||||
|
||||
|
@ -97,4 +98,35 @@ int Ndb_check_socket_hup(NDB_SOCKET_TYPE sock)
|
|||
return 1;
|
||||
|
||||
return 0;
|
||||
#else /* HAVE_POLL */
|
||||
fd_set readfds, writefds, errorfds;
|
||||
struct timeval tv= {0,0};
|
||||
int s_err;
|
||||
int s_err_size= sizeof(s_err);
|
||||
|
||||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&errorfds);
|
||||
|
||||
FD_SET(sock, &readfds);
|
||||
FD_SET(sock, &writefds);
|
||||
FD_SET(sock, &errorfds);
|
||||
|
||||
if(select(1, &readfds, &writefds, &errorfds, &tv)<0)
|
||||
return 1;
|
||||
|
||||
if(FD_ISSET(sock,&errorfds))
|
||||
return 1;
|
||||
|
||||
s_err=0;
|
||||
if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
|
||||
return(1);
|
||||
|
||||
if (s_err)
|
||||
{ /* getsockopt could succeed */
|
||||
return(1); /* but return an error... */
|
||||
}
|
||||
|
||||
return 0;
|
||||
#endif /* HAVE_POLL */
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ int Ndb_check_socket_hup(NDB_SOCKET_TYPE sock)
|
|||
FD_SET(sock, &writefds);
|
||||
FD_SET(sock, &errorfds);
|
||||
|
||||
if(select(1, &readfds, &writefds, &errorfds, &t)==SOCKET_ERROR)
|
||||
if(select(1, &readfds, &writefds, &errorfds, &tv)==SOCKET_ERROR)
|
||||
return 1;
|
||||
|
||||
if(FD_ISSET(sock,&errorfds))
|
||||
|
|
Loading…
Reference in a new issue