From 643f3c67b24a03ea12d0d3420d78a734aedf5b1d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 18 Sep 2009 11:06:20 +0200 Subject: [PATCH] Log session timeout. Reenable ASSOC_UP. 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 | 8 +++++--- src/session.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/seshigh.c b/src/seshigh.c index 19c771d..7e08220 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -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) diff --git a/src/session.h b/src/session.h index f7c81ce..e5343ff 100644 --- a/src/session.h +++ b/src/session.h @@ -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; -- 1.7.10.4