privacore-open-source-searc.../PageHealthCheck.cpp
Ivan Skytte Jørgensen beeddcf35d Got rid of gb-include.h
2018-07-26 17:29:51 +02:00

16 lines
463 B
C++

#include "TcpServer.h"
#include "Pages.h"
#include "HttpServer.h"
#include "SafeBuf.h"
#include "Stats.h"
bool sendPageHealthCheck( TcpSocket *s , HttpRequest *r ) {
StackBuf<64*1024> p;
int32_t uptime = time(NULL) - g_stats.m_uptimeStart;
p.safePrintf("{\n\"status\":\"active\",\n\"uptime_secs\":%" PRId32"\n}\n", uptime);
return g_httpServer.sendDynamicPage (s, (char*)p.getBufStart(), p.length(), -1, false, "application/json", -1, NULL, "utf8" );
}