qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1157273 - /qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp
Date Fri, 12 Aug 2011 22:32:14 GMT
Author: astitcher
Date: Fri Aug 12 22:32:14 2011
New Revision: 1157273

URL: http://svn.apache.org/viewvc?rev=1157273&view=rev
Log:
QPID-3405: Slightly hacky way to get reconnect to work
- If we fail to reset the epoll settings of a file handle when going
  round the poll loop and it's because the handle is not in the epoll
  set then just try to add it into the epoll set.

  This gets round the case where connect closes a socket fd (implicitly
  taking out of all epoll sets) and then tries to connect again.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp?rev=1157273&r1=1157272&r2=1157273&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp Fri Aug 12 22:32:14 2011
@@ -384,7 +384,12 @@ void PollerPrivate::resetMode(PollerHand
         epe.data.u64 = 0; // Keep valgrind happy
         epe.data.ptr = &eh;
 
-        QPID_POSIX_CHECK(::epoll_ctl(epollFd, EPOLL_CTL_MOD, eh.fd(), &epe));
+        int rc = ::epoll_ctl(epollFd, EPOLL_CTL_MOD, eh.fd(), &epe);
+        // If something has closed the fd in the meantime try adding it back
+        if (rc ==-1 && errno == ENOENT) {
+            rc = ::epoll_ctl(epollFd, EPOLL_CTL_ADD, eh.fd(), &epe);
+        }
+        QPID_POSIX_CHECK(rc);
 
         eh.setActive();
         return;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message