]> git.tdb.fi Git - libs/net.git/blobdiff - source/net/resolve.h
Use default member initializers where possible
[libs/net.git] / source / net / resolve.h
index 21737ff4794bb0def530bd364cae00a2291ec1c2..6a0479e6aa363f2b22a49b5e1b999860a7666417 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_NET_RESOLVE_H_
 #define MSP_NET_RESOLVE_H_
 
+#include <deque>
 #include <string>
 #include <msp/core/mutex.h>
 #include <msp/core/semaphore.h>
@@ -35,14 +36,12 @@ class Resolver
 private:
        struct Task
        {
-               unsigned tag;
+               unsigned tag = 0;
                std::string host;
                std::string serv;
-               Family family;
-               SockAddr *addr;
-               std::runtime_error *error;
-
-               Task();
+               Family family = UNSPEC;
+               SockAddr *addr = 0;
+               std::runtime_error *error = 0;
 
                bool is_complete() const { return addr || error; }
        };
@@ -50,11 +49,11 @@ private:
        class WorkerThread: public Thread
        {
        private:
-               std::list<Task> queue;
+               std::deque<Task> queue;
                Mutex queue_mutex;
                Semaphore sem;
                IO::Pipe notify_pipe;
-               bool done;
+               bool done = false;
 
        public:
                WorkerThread();
@@ -67,7 +66,7 @@ private:
                IO::Pipe &get_notify_pipe() { return notify_pipe; }
 
        private:
-               virtual void main();
+               void main() override;
        };
 
 public:
@@ -75,9 +74,9 @@ public:
        sigc::signal<void, unsigned, const std::exception &> signal_resolve_failed;
 
 private:
-       IO::EventDispatcher *event_disp;
+       IO::EventDispatcher *event_disp = 0;
        WorkerThread thread;
-       unsigned next_tag;
+       unsigned next_tag = 1;
 
 public:
        Resolver();