From: Pieter Lexis Date: Mon, 12 Nov 2018 16:23:57 +0000 (+0100) Subject: ixfrdist: hook up webserver thread X-Git-Tag: auth-4.2.0-alpha1~31^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f4d2df1dda4637e44b79255e71a4eafe667bf16;p=thirdparty%2Fpdns.git ixfrdist: hook up webserver thread --- diff --git a/pdns/ixfrdist-web.cc b/pdns/ixfrdist-web.cc index 334306efe3..93f610aa7c 100644 --- a/pdns/ixfrdist-web.cc +++ b/pdns/ixfrdist-web.cc @@ -31,18 +31,13 @@ IXFRDistWebServer::IXFRDistWebServer(const ComboAddress &listenAddress, const Ne // TODO wrap in smart pointer d_ws = new WebServer(listenAddress.toString() , listenAddress.getPort()); d_ws->setACL(acl); + d_ws->registerWebHandler("/metrics", boost::bind(&IXFRDistWebServer::getMetrics, this, _1, _2)); d_ws->bind(); } void IXFRDistWebServer::go() { - // std::thread wt(IXFRDistWebServer::webThread); - d_ws->registerWebHandler("/metrics", boost::bind(&IXFRDistWebServer::getMetrics, this, _1, _2)); - d_ws->go(); - // wt.detach(); -} - -void IXFRDistWebServer::webThread() { setThreadName("ixfrdist/web"); + d_ws->go(); } void IXFRDistWebServer::getMetrics(HttpRequest* req, HttpResponse* resp) { diff --git a/pdns/ixfrdist-web.hh b/pdns/ixfrdist-web.hh index e6aaae398c..7b2871453f 100644 --- a/pdns/ixfrdist-web.hh +++ b/pdns/ixfrdist-web.hh @@ -22,7 +22,6 @@ #pragma once #include "webserver.hh" #include "iputils.hh" -//#include "ixfrdist-stats.hh" class IXFRDistWebServer { @@ -32,7 +31,6 @@ class IXFRDistWebServer private: WebServer *d_ws; - void webThread(); // All endpoints void getMetrics(HttpRequest* req, HttpResponse* resp); diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index d82f513843..ad8b05065e 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -1257,7 +1257,7 @@ int main(int argc, char** argv) { } auto ws = IXFRDistWebServer(config["webserver-address"].as(), wsACL); - ws.go(); + std::thread (&IXFRDistWebServer::go, ws).detach(); } int newuid = 0;