+ rs->payload = "<search><status>OK</status></search>";
+ http_send_response(c);
+}
+
+
+static void cmd_stat(struct http_channel *c)
+{
+ struct http_request *rq = c->request;
+ struct http_response *rs = c->response;
+ struct http_session *s = locate_session(rq, rs);
+ struct statistics stat;
+
+ if (!s)
+ return;
+
+ statistics(s->psession, &stat);
+
+ wrbuf_rewind(c->wrbuf);
+ wrbuf_puts(c->wrbuf, "<stat>");
+ 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);
+ wrbuf_printf(c->wrbuf, "<unconnected>%d</unconnected>\n", stat.num_no_connection);
+ wrbuf_printf(c->wrbuf, "<connecting>%d</connecting>\n", stat.num_connecting);
+ wrbuf_printf(c->wrbuf, "<initializing>%d</initializing>\n", stat.num_initializing);
+ wrbuf_printf(c->wrbuf, "<searching>%d</searching>\n", stat.num_searching);
+ wrbuf_printf(c->wrbuf, "<presenting>%d</presenting>\n", stat.num_presenting);
+ wrbuf_printf(c->wrbuf, "<idle>%d</idle>\n", stat.num_idle);
+ wrbuf_printf(c->wrbuf, "<failed>%d</failed>\n", stat.num_failed);
+ wrbuf_printf(c->wrbuf, "<error>%d</error>\n", stat.num_error);
+ wrbuf_puts(c->wrbuf, "</stat>");
+ rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf));
+ http_send_response(c);