You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2013/08/05 17:53:35 UTC

svn commit: r1510573 - /qpid/proton/trunk/proton-c/src/posix/driver.c

Author: tross
Date: Mon Aug  5 15:53:35 2013
New Revision: 1510573

URL: http://svn.apache.org/r1510573
Log:
PROTON-372 - Add better handing of poll status values in the driver.
Applied patch from Bozo Dragojevic.

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

Modified: qpid/proton/trunk/proton-c/src/posix/driver.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/posix/driver.c?rev=1510573&r1=1510572&r2=1510573&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/posix/driver.c (original)
+++ qpid/proton/trunk/proton-c/src/posix/driver.c Mon Aug  5 15:53:35 2013
@@ -805,6 +805,24 @@ int pn_driver_wait_3(pn_driver_t *d)
       c->pending_tick = (c->wakeup &&  c->wakeup <= now);
       if (idx && d->fds[idx].revents & POLLERR)
           pn_connector_close(c);
+      else if (idx && (d->fds[idx].revents & POLLHUP)) {
+        if (c->trace & (PN_TRACE_FRM | PN_TRACE_RAW | PN_TRACE_DRV)) {
+          fprintf(stderr, "hangup on connector %s\n", c->name);
+        }
+        /* poll() is signalling POLLHUP. to see what happened we need
+         * to do an actual recv() to get the error code. But we might
+         * be in a state where we're not interested in input, in that
+         * case try to get the error code via send() */
+        if (d->fds[idx].events & POLLIN)
+          c->pending_read = true;
+        else if (d->fds[idx].events & POLLOUT)
+          c->pending_write = true;
+      } else if (idx && (d->fds[idx].revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP))) {
+          if (c->trace & (PN_TRACE_FRM | PN_TRACE_RAW | PN_TRACE_DRV)) {
+            fprintf(stderr, "Unexpected poll events: %04x on %s\n",
+                    d->fds[idx].revents, c->name);
+          }
+      }
     }
     c = c->connector_next;
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org