From: Date: February 27 2006 11:19am Subject: bk commit into 5.0 tree (msvensson:1.2088) BUG#2845 List-Archive: http://lists.mysql.com/commits/3176 X-Bug: 2845 Message-Id: <20060227101954.AD861207825@localhost.localdomain> Below is the list of changes that have just been committed into a local 5.0 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2088 06/02/27 11:19:43 msvensson@neptunus.(none) +1 -0 BUG#2845 client fails to reconnect if using TCP/IP - Use 'poll' if available - Check that sd <= FD_SETSIZE if using 'select' sql/net_serv.cc 1.86 06/02/27 11:19:36 msvensson@neptunus.(none) +17 -1 Use 'poll' in favor of 'select' if avaliable This is to avoid the limitation with 'select' only being able to handle fd's with numbers <= 1024 as default. If 'poll' is not available use 'select' but check that we are not having a number higher than FD_SETSIZE # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: neptunus.(none) # Root: /home/msvensson/mysql/mysql-5.0 --- 1.85/sql/net_serv.cc 2006-02-16 12:02:34 +01:00 +++ 1.86/sql/net_serv.cc 2006-02-27 11:19:36 +01:00 @@ -212,19 +212,35 @@ static my_bool net_data_is_ready(my_socket sd) { +#ifdef HAVE_POLL + struct pollfd ufds; + int res; + + ufds.fd= sd; + ufds.events= POLLIN | POLLPRI; + if (!(res= poll(&ufds, 1, 0))) + return 0; + if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI))) + return 0; + return 1; +#else fd_set sfds; struct timeval tv; int res; + if (sd >= FD_SETSIZE) + return 0; + FD_ZERO(&sfds); FD_SET(sd, &sfds); tv.tv_sec= tv.tv_usec= 0; if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0) - return FALSE; + return 0; else return test(res ? FD_ISSET(sd, &sfds) : 0); +#endif }