]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/dynlistener.cc
auth: switch circleci mssql image
[thirdparty/pdns.git] / pdns / dynlistener.cc
index 04bf537c103cdda167aef645a6a7369ffd0f61c5..c3a1dc7e3e34245c81b98a7a1de4e0d9709b10d9 100644 (file)
@@ -52,6 +52,7 @@
 #include "dnspacket.hh"
 #include "logger.hh"
 #include "statbag.hh"
+#include "threadname.hh"
 
 extern StatBag S;
 
@@ -164,21 +165,14 @@ void DynListener::listenOnTCP(const ComboAddress& local)
 }
 
 
-DynListener::DynListener(const ComboAddress& local)
+DynListener::DynListener(const ComboAddress& local) :
+  d_tcp(true)
 {
   listenOnTCP(local);
-  d_tcp=true;
-  d_client=-1;
-  d_tid=0;
-  d_ppid=0;
 }
 
 DynListener::DynListener(const string &progname)
 {
-  d_client=-1;
-  d_tid=0;
-  d_ppid=0;
-  d_s=-1;
 
   if(!progname.empty()) {
     string socketname = ::arg()["socket-dir"];
@@ -205,7 +199,6 @@ DynListener::DynListener(const string &progname)
   }
   else
     d_nonlocal=false; // we listen on stdin!
-  d_tcp=false;
 }
 
 void DynListener::go()
@@ -216,6 +209,7 @@ void DynListener::go()
 
 void *DynListener::theListenerHelper(void *p)
 {
+  setThreadName("pdns/ctrlListen");
   DynListener *us=static_cast<DynListener *>(p);
   us->theListener();
   g_log<<Logger::Error<<"Control listener aborted, please file a bug!"<<endl;
@@ -227,7 +221,7 @@ string DynListener::getLine()
   vector<char> mesg;
   mesg.resize(1024000);
 
-  int len;
+  ssize_t len;
 
   ComboAddress remote;
   socklen_t remlen=remote.getSocklen();
@@ -290,12 +284,12 @@ string DynListener::getLine()
     else if(len==0)
       throw PDNSException("Guardian exited - going down as well");
 
-    if(len == (int)mesg.size())
+    if(static_cast<size_t>(len) == mesg.size())
       throw PDNSException("Line on control console was too long");
 
     mesg[len]=0;
   }
-  
+
   return &mesg[0];
 }