X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-socket-manager.cpp;h=2cb2fde329f7d6e0756965215254ce2e4d07020d;hb=b44e3f59721a74d2c99a7bac337114f677564b99;hp=d872cf379211448fcd2fa583e4cc14549dc003d1;hpb=5dddeb732a1409f9787cbdb3ce993f73a47f2dcc;p=yazpp-moved-to-github.git diff --git a/src/yaz-socket-manager.cpp b/src/yaz-socket-manager.cpp index d872cf3..2cb2fde 100644 --- a/src/yaz-socket-manager.cpp +++ b/src/yaz-socket-manager.cpp @@ -124,10 +124,21 @@ void SocketManager::inspect_poll_result(int res, struct yaz_poll_fd *fds, time_t now = time(0); int i; int no_put_events = 0; - SocketEntry *p; + int no_lost_observers = 0; - for (i = 0, p = m_observers; p; p = p->next, i++) + for (i = 0; i < no_fds; i++) { + SocketEntry *p; + for (p = m_observers; p; p = p->next) + if (p->fd == fds[i].fd) + break; + if (!p) + { + // m_observers list changed since poll started + no_lost_observers++; + continue; + } + enum yaz_poll_mask output_mask = fds[i].output_mask; int mask = 0; @@ -172,11 +183,14 @@ void SocketManager::inspect_poll_result(int res, struct yaz_poll_fd *fds, } else { - // bug #2035 - - yaz_log(YLOG_WARN, "unhandled socket event. yaz_poll returned %d", res); - yaz_log(YLOG_WARN, "no_put_events=%d no_fds=%d i=%d timeout=%d", - no_put_events, no_fds, i, timeout); + if (no_lost_observers == 0) + { + // bug #2035 + yaz_log(YLOG_WARN, "unhandled socket event. yaz_poll returned %d", + res); + yaz_log(YLOG_WARN, "no_put_events=%d no_fds=%d i=%d timeout=%d", + no_put_events, no_fds, i, timeout); + } } } @@ -239,7 +253,10 @@ int SocketManager::processEvent() while ((res = yaz_poll(fds, no_fds, timeout, 0)) < 0 && pass < 10) { if (errno == EINTR) - continue; + { + delete [] fds; + return 1; + } yaz_log(YLOG_ERRNO|YLOG_WARN, "yaz_poll"); yaz_log(YLOG_WARN, "errno=%d timeout=%d", errno, timeout); }