From: Giannis Kosmas Date: Tue, 29 May 2012 00:32:28 +0000 (+0300) Subject: Calculation of keepAlive timeout X-Git-Tag: v1.6.14~6 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=27b510020a28c83feb607998371d824284fc24de;p=pazpar2-moved-to-github.git Calculation of keepAlive timeout keepAlive timeout is calculated based on session timeout defined in service configuration and is returned in the init response. --- diff --git a/js/pz2.js b/js/pz2.js index a57688f..b321e5a 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -201,6 +201,9 @@ pz2.prototype = context.sessionID = data.getElementsByTagName("session")[0] .childNodes[0].nodeValue; + if (data.getElementsByTagName("keepAlive").length > 0) { + context.keepAlive = data.getElementsByTagName("keepAlive")[0].childNodes[0].nodeValue; + } context.pingTimer = setTimeout( function () { diff --git a/src/http_command.c b/src/http_command.c index 567189e..84fac12 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -470,6 +470,8 @@ static void cmd_init(struct http_channel *c) wrbuf_puts(c->wrbuf, "" "" PAZPAR2_PROTOCOL_VERSION ""); + wrbuf_printf(c->wrbuf, "%d\n", 1000 * ((s->psession->service->session_timeout >= 20) ? + (s->psession->service->session_timeout - 10) : 50)); response_close(c, "init"); }