MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:msvensson Date:March 1 2006 2:21pm
Subject:bk commit into 5.0 tree (msvensson:1.2090) BUG#2845
View as plain text  
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.2090 06/03/01 15:21:03 msvensson@shellback.(none) +1 -0
  Bug#2845 client fails to reconnect if using TCP/IP
   - Change to use non blocking read to empty channel in case of too large sd number
   - Don't check for too large socket number on Windows.

  sql/net_serv.cc
    1.87 06/03/01 15:20:57 msvensson@shellback.(none) +21 -5
    Windows does not need protection from sd >= FD_SETSIZE, it uses an array to store the sd's it should read from.
    Change the handler for when "net_data_is_ready" returns -1 to perform nonblocking read to empty the net.
    Only include that handler if HAVE_POLL is not defined  and not windows

# 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:	shellback.(none)
# Root:	/home/msvensson/mysql/mysql-5.0

--- 1.86/sql/net_serv.cc	2006-02-27 16:44:19 +01:00
+++ 1.87/sql/net_serv.cc	2006-03-01 15:20:57 +01:00
@@ -229,8 +229,12 @@
   struct timeval tv;
   int res;
 
+#ifndef __WIN__
+  /* Windows uses an _array_ of 64 fd's as default, so it's safe */
   if (sd >= FD_SETSIZE)
     return -1;
+  #define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
+#endif
 
   FD_ZERO(&sfds);
   FD_SET(sd, &sfds);
@@ -271,7 +275,7 @@
   int count, ready;
   DBUG_ENTER("net_clear");
 #if !defined(EMBEDDED_LIBRARY)
-  while((ready= net_data_is_ready(net->vio->sd)) != 0)
+  while((ready= net_data_is_ready(net->vio->sd)) > 0)
   {
     /* The socket is ready */
     if ((count= vio_read(net->vio, (char*) (net->buff),
@@ -286,15 +290,27 @@
     }
     else
     {
-      /* No data to read and 'net_data_is_ready' returned "don't know" */
-      if (ready == -1)
-        break;
-
       DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
       net->error= 2;
       break;
     }
   }
+#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
+  /* 'net_data_is_ready' returned "don't know" */
+  if (ready == -1)
+  {
+    /* Read unblocking to clear net */
+    my_bool old_mode;
+    if (!vio_blocking(net->vio, FALSE, &old_mode))
+    {
+      while ((count= vio_read(net->vio, (char*) (net->buff),
+                              (uint32) net->max_packet)) > 0)
+	DBUG_PRINT("info",("skipped %d bytes from file: %s",
+			   count, vio_description(net->vio)));
+      vio_blocking(net->vio, TRUE, &old_mode);
+    }
+  }
+#endif
 #endif
   net->pkt_nr=net->compress_pkt_nr=0;		/* Ready for new command */
   net->write_pos=net->buff;
Thread
bk commit into 5.0 tree (msvensson:1.2090) BUG#2845msvensson1 Mar