Move stopping into ServerPool.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 10 Apr 2013 22:24:33 +0000 (00:24 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 10 Apr 2013 22:24:37 +0000 (00:24 +0200)
main.cpp
serverpool.cpp
serverpool.h

index 1979bb3..1f7313a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -396,9 +396,7 @@ int main(int argc, char **argv)
        for (size_t i = 0; i < inputs.size(); ++i) {
                inputs[i]->stop();
        }
-       for (int i = 0; i < num_servers; ++i) { 
-               servers->get_server(i)->stop();
-       }
+       servers->stop();
 
        fprintf(stderr, "Serializing state and re-execing...\n");
        int state_fd = make_tempfile(collect_state(
index 09fe435..cf6933c 100644 (file)
@@ -59,6 +59,13 @@ void ServerPool::run()
        }
 }
        
+void ServerPool::stop()
+{
+       for (int i = 0; i < num_servers; ++i) {
+               servers[i].stop();
+       }
+}
+       
 vector<ClientStats> ServerPool::get_client_stats() const
 {
        vector<ClientStats> ret;
index c22fb67..5dee5f7 100644 (file)
@@ -35,6 +35,9 @@ public:
        // Starts all the servers.
        void run();
 
+       // Stops all the servers.
+       void stop();
+
        std::vector<ClientStats> get_client_stats() const;
 
 private: