Log session timeout. Reenable ASSOC_UP.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 18 Sep 2009 09:06:20 +0000 (11:06 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 18 Sep 2009 09:06:20 +0000 (11:06 +0200)
The association_state ASSOC_UP was last used in YAZ 2.0.30. It
was probably removed by mistake. We enable it - but for Z39.50
sessions only, so that when a timeout occurs we can send a Z39.50
close PDU again. The session timeout is now also logged at "session"
log level.

src/seshigh.c
src/session.h

index 19c771d..7e08220 100644 (file)
@@ -377,7 +377,7 @@ void ir_session(IOCHAN h, int event)
     {
         if (assoc->state != ASSOC_UP)
         {
-            yaz_log(YLOG_DEBUG, "Final timeout - closing connection.");
+            yaz_log(log_session, "Timeout. Closing connection");
             /* do we need to lod this at all */
             cs_close(conn);
             destroy_association(assoc);
@@ -385,8 +385,7 @@ void ir_session(IOCHAN h, int event)
         }
         else
         {
-            yaz_log(log_sessiondetail, 
-                    "Session idle too long. Sending close.");
+            yaz_log(log_sessiondetail, "Timeout. Sending Z39.50 Close");
             do_close(assoc, Z_Close_lackOfActivity, 0);
         }
         return;
@@ -2364,6 +2363,9 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb)
                              binitres->errstring);
         *resp->result = 0;
     }
+    else
+        assoc->state = ASSOC_UP;
+    
     if (log_request)
     {
         if (!req->idAuthentication)
index f7c81ce..e5343ff 100644 (file)
@@ -98,8 +98,8 @@ typedef struct request_q
  */
 typedef enum
 {
-    ASSOC_NEW,                /* not initialized yet */
-    ASSOC_UP,                 /* normal operation */
+    ASSOC_NEW,                /* not initialized yet or HTTP session */
+    ASSOC_UP,                 /* Z39.50 session is UP */
     ASSOC_DEAD                /* dead. Close if input arrives */
 } association_state;