From 4a61cdbbd827ee9ccb50aa84611fa262432da084 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 25 Jul 2007 11:41:32 +0000 Subject: [PATCH] Z39.50 session/connect timeout in parameters --- src/connection.c | 6 +++--- src/getaddrinfo.c | 6 ++++-- src/logic.c | 7 ++++--- src/parameters.h | 4 +++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/connection.c b/src/connection.c index 109aa58..e079eae 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1,4 +1,4 @@ -/* $Id: connection.c,v 1.7 2007-07-12 08:01:06 adam Exp $ +/* $Id: connection.c,v 1.8 2007-07-25 11:41:32 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -180,7 +180,7 @@ static void connection_handler(IOCHAN i, int event) co->state = Conn_Open; if (cl) client_set_state(cl, Client_Connected); - iochan_settimeout(i, 180); + iochan_settimeout(i, global_parameters.z3950_session_timeout); } } @@ -393,7 +393,7 @@ int connection_connect(struct connection *con) con->link = link; con->state = Conn_Connecting; con->iochan = iochan_create(cs_fileno(link), connection_handler, 0); - iochan_settimeout(con->iochan, 30); + iochan_settimeout(con->iochan, global_parameters.z3950_connect_timeout); iochan_setdata(con->iochan, con); pazpar2_add_channel(con->iochan); diff --git a/src/getaddrinfo.c b/src/getaddrinfo.c index ce531ef..8d2252f 100644 --- a/src/getaddrinfo.c +++ b/src/getaddrinfo.c @@ -1,4 +1,4 @@ -/* $Id: getaddrinfo.c,v 1.6 2007-07-09 20:00:41 adam Exp $ +/* $Id: getaddrinfo.c,v 1.7 2007-07-25 11:41:32 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -65,7 +65,9 @@ void perform_getaddrinfo(struct work *w) *(port++) = '\0'; else port = "210"; - + + yaz_log(YLOG_LOG, "Resolving %s", w->hostport); + sleep(10); #if HAVE_GETADDRINFO hints.ai_flags = 0; hints.ai_family = PF_INET; diff --git a/src/logic.c b/src/logic.c index 9e0e6dc..42e193a 100644 --- a/src/logic.c +++ b/src/logic.c @@ -1,4 +1,4 @@ -/* $Id: logic.c,v 1.55 2007-07-18 13:37:30 adam Exp $ +/* $Id: logic.c,v 1.56 2007-07-25 11:41:32 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -93,10 +93,11 @@ struct parameters global_parameters = 100, MAX_CHUNK, 0, - 0 + 0, + 180, + 30 }; - // Recursively traverse query structure to extract terms. void pull_terms(NMEM nmem, struct ccl_rpn_node *n, char **termlist, int *num) { diff --git a/src/parameters.h b/src/parameters.h index c6ece74..5ddef27 100644 --- a/src/parameters.h +++ b/src/parameters.h @@ -1,4 +1,4 @@ -/* $Id: parameters.h,v 1.4 2007-06-06 11:56:35 marc Exp $ +/* $Id: parameters.h,v 1.5 2007-07-25 11:41:32 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -42,6 +42,8 @@ struct parameters { int chunk; ODR odr_out; ODR odr_in; + int z3950_session_timeout; + int z3950_connect_timeout; }; extern struct parameters global_parameters; -- 1.7.10.4