Author: cliffjansen
Date: Tue Apr  9 01:44:04 2013
New Revision: 1465858

URL: http://svn.apache.org/r1465858
Log:
PROTON-286: Windows hang: change blocking call to non-blocking when pending 
close count > 0

Modified:
    qpid/proton/trunk/proton-c/src/windows/driver.c

Modified: qpid/proton/trunk/proton-c/src/windows/driver.c
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/windows/driver.c?rev=1465858&r1=1465857&r2=1465858&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/windows/driver.c (original)
+++ qpid/proton/trunk/proton-c/src/windows/driver.c Tue Apr  9 01:44:04 2013
@@ -824,12 +824,19 @@ int pn_driver_wait_2(pn_driver_t *d, int
   }
 
   struct timeval to = {0};
-  if (timeout > 0) {
-    // convert millisecs to sec and usec:
-    to.tv_sec = timeout/1000;
-    to.tv_usec = (timeout - (to.tv_sec * 1000)) * 1000;
+  struct timeval *to_arg = &to;
+  // block only if (timeout == 0) and (closed_count == 0)
+  if (d->closed_count == 0) {
+    if (timeout > 0) {
+      // convert millisecs to sec and usec:
+      to.tv_sec = timeout/1000;
+      to.tv_usec = (timeout - (to.tv_sec * 1000)) * 1000;
+    }
+    else if (timeout < 0) {
+       to_arg = NULL;
+    }
   }
-  int nfds = select(/* d->max_fds */ 0, &d->readfds, &d->writefds, NULL, 
timeout < 0 ? NULL : &to);
+  int nfds = select(/* d->max_fds */ 0, &d->readfds, &d->writefds, NULL, 
to_arg);
   if (nfds == SOCKET_ERROR) {
     errno = WSAGetLastError();
     pn_i_error_from_errno(d->error, "select");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to