From 6f4d2df1dda4637e44b79255e71a4eafe667bf16 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Mon, 12 Nov 2018 17:23:57 +0100 Subject: [PATCH] ixfrdist: hook up webserver thread --- pdns/ixfrdist-web.cc | 9 ++------- pdns/ixfrdist-web.hh | 2 -- pdns/ixfrdist.cc | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) 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; -- 2.47.3