You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2011/08/13 00:32:14 UTC
svn commit: r1157273 -
/qpid/trunk/qpid/cpp/src/qpid/sys/epoll/EpollPoller.cpp
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