/*
- * $Id: http_command.c,v 1.4 2007-01-04 02:35:42 quinn Exp $
+ * $Id: http_command.c,v 1.5 2007-01-04 02:53:37 quinn Exp $
*/
#include <stdio.h>
struct http_response *rs = c->response;
struct http_session *s = locate_session(rq, rs);
struct statistics stat;
+ int clients = session_active_clients(s->psession);
if (!s)
return;
wrbuf_rewind(c->wrbuf);
wrbuf_puts(c->wrbuf, "<stat>");
+ wrbuf_printf(c->wrbuf, "<activeclients>%d</activeclients>\n", clients);
wrbuf_printf(c->wrbuf, "<hits>%d</hits>\n", stat.num_hits);
wrbuf_printf(c->wrbuf, "<records>%d</records>\n", stat.num_records);
wrbuf_printf(c->wrbuf, "<clients>%d</clients>\n", stat.num_clients);
-/* $Id: search.js,v 1.3 2007-01-02 11:02:50 sondberg Exp $
+/* $Id: search.js,v 1.4 2007-01-04 02:53:37 quinn Exp $
* ---------------------------------------------------
* Javascript container
*/
var merged = Number(xml.getElementsByTagName('merged')[0].childNodes[0].nodeValue);
var start = Number(xml.getElementsByTagName('start')[0].childNodes[0].nodeValue);
var num = Number(xml.getElementsByTagName('num')[0].childNodes[0].nodeValue);
+ var clients = Number(xml.getElementsByTagName("activeclients")[0].childNodes[0].nodeValue);
body.innerHTML = '<b>Records : ';
body.innerHTML += (start + 1) + ' to ' + (start + num) +
' of ' + merged + ' (total hits: ' + total + ')</b>';
body.innerHTML += '</p>';
}
shown++;
- if (shown < 5)
- searchtimer = setTimeout(check_search, 1000);
- else
- searchtimer = setTimeout(check_search, 2000);
+ if (clients > 0)
+ {
+ if (shown < 5)
+ searchtimer = setTimeout(check_search, 1000);
+ else
+ searchtimer = setTimeout(check_search, 2000);
+ }
}
if (!termtimer)
termtimer = setTimeout(check_termlist, 1000);
var xml = xtermlist.responseXML;
var body = document.getElementById("termlist");
var hits = xml.getElementsByTagName("term");
+ var clients =
+ Number(xml.getElementsByTagName("activeclients")[0].childNodes[0].nodeValue);
if (!hits[0])
{
termtimer = setTimeout(check_termlist, 1000);
'</a>';
body.innerHTML += '<br>';
}
- termtimer = setTimeout(check_termlist, 2000);
+ if (clients > 0)
+ termtimer = setTimeout(check_termlist, 2000);
}
}
var xml = xstat.responseXML;
var body = document.getElementById("stat");
var nodes = xml.childNodes[0].childNodes;
+ var clients =
+ Number(xml.getElementsByTagName("activeclients")[0].childNodes[0].nodeValue);
if (!nodes[0])
{
stattimer = setTimeout(check_stat, 500);
body.innerHTML += ' ' + name + '=' + value;
}
body.innerHTML += ')';
- stattimer = setTimeout(check_stat, 2000);
+ if (clients > 0)
+ stattimer = setTimeout(check_stat, 2000);
}
}