diff options
author | Andrew Stitcher <astitcher@apache.org> | 2011-08-12 22:32:14 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2011-08-12 22:32:14 +0000 |
commit | cde4e55e47ae031af23746b45981fd0fd3a40cad (patch) | |
tree | 97803ac33f0d365a04f2ed6cd6b5622711290b40 /cpp/src | |
parent | ee500880a0a69400913e3b4055c7796dcd25ad65 (diff) | |
download | qpid-python-cde4e55e47ae031af23746b45981fd0fd3a40cad.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1157273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/sys/epoll/EpollPoller.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/epoll/EpollPoller.cpp b/cpp/src/qpid/sys/epoll/EpollPoller.cpp index 9ad05c71a3..dcc9d9181c 100644 --- a/cpp/src/qpid/sys/epoll/EpollPoller.cpp +++ b/cpp/src/qpid/sys/epoll/EpollPoller.cpp @@ -384,7 +384,12 @@ void PollerPrivate::resetMode(PollerHandlePrivate& eh) { 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; |