diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/lib/nfs/Connection.cxx | 13 |
2 files changed, 14 insertions, 1 deletions
@@ -1,4 +1,6 @@ ver 0.20.4 (not yet released) +* input + - nfs: fix freeze after reconnect * output - sndio: work around a libroar C++ incompatibility * workaround for GCC 4.9 "constexpr" bug diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index 16f6c001d..e41c4acd8 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -396,6 +396,17 @@ NfsConnection::ScheduleSocket() assert(GetEventLoop().IsInside()); assert(context != nullptr); + const int which_events = nfs_which_events(context); + + if (which_events == POLLOUT && SocketMonitor::IsDefined()) + /* kludge: if libnfs asks only for POLLOUT, it means + that it is currently waiting for the connect() to + finish - rpc_reconnect_requeue() may have been + called from inside nfs_service(); we must now + unregister the old socket and register the new one + instead */ + SocketMonitor::Steal(); + if (!SocketMonitor::IsDefined()) { int _fd = nfs_get_fd(context); if (_fd < 0) @@ -405,7 +416,7 @@ NfsConnection::ScheduleSocket() SocketMonitor::Open(_fd); } - SocketMonitor::Schedule(libnfs_to_events(nfs_which_events(context))); + SocketMonitor::Schedule(libnfs_to_events(which_events)); } inline int |