Bug fixes. Explain document in config. Logging changes - dsp elapsed time.
[yazpp-moved-to-github.git] / src / yaz-socket-manager.cpp
index 536c5b6..82bc0a3 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 1998-2001, Index Data.
+ * Copyright (c) 1998-2003, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: yaz-socket-manager.cpp,v 1.19 2002-10-09 12:50:26 adam Exp $
+ * $Id: yaz-socket-manager.cpp,v 1.22 2003-12-16 11:26:42 adam Exp $
  */
 #include <assert.h>
 #ifdef WIN32
@@ -76,6 +76,11 @@ void Yaz_SocketManager::maskObserver(IYazSocketObserver *observer, int mask)
 {
     YazSocketEntry *se;
 
+    yaz_log(m_log, "obs=%p read=%d write=%d except=%d", observer,
+                   mask & YAZ_SOCKET_OBSERVE_READ,
+                   mask & YAZ_SOCKET_OBSERVE_WRITE,
+                   mask & YAZ_SOCKET_OBSERVE_EXCEPT);
+
     se = *lookupObserver(observer);
     if (se)
        se->mask = mask;
@@ -194,12 +199,14 @@ int Yaz_SocketManager::processEvent()
            event->observer = p->observer;
            event->event = mask;
            putEvent (event);
+
+           yaz_log (m_log, "putEvent I/O mask=%d", mask);
        }
-       else if (res == 0 && p->timeout && p->timeout_this == timeout)
+       else if (p->timeout && (now - p->last_activity) >= p->timeout)
        {
            YazSocketEvent *event = new YazSocketEvent;
             assert (p->last_activity);
-           yaz_log (m_log, "timeout, now = %ld last_activity=%ld timeout=%d",
+           yaz_log (m_log, "putEvent timeout, now = %ld last_activity=%ld timeout=%d",
                      now, p->last_activity, p->timeout);
            p->last_activity = now;
            event->observer = p->observer;