From 27b510020a28c83feb607998371d824284fc24de Mon Sep 17 00:00:00 2001 From: Giannis Kosmas Date: Tue, 29 May 2012 03:32:28 +0300 Subject: [PATCH] Calculation of keepAlive timeout keepAlive timeout is calculated based on session timeout defined in service configuration and is returned in the init response. --- js/pz2.js | 3 +++ src/http_command.c | 2 ++ 2 files changed, 5 insertions(+) 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"); } -- 1.7.10.4