Merge commit '796223f5bc3a4896e6398733c798390158479400'
[sliver-openvswitch.git] / vswitchd / ovs-vswitchd.c
index 3b65178..78ebd31 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <config.h>
 
-#include <assert.h>
 #include <errno.h>
 #include <getopt.h>
 #include <limits.h>
@@ -52,6 +51,7 @@
 #include "vconn.h"
 #include "vlog.h"
 #include "lib/vswitch-idl.h"
+#include "worker.h"
 
 VLOG_DEFINE_THIS_MODULE(vswitchd);
 
@@ -85,8 +85,6 @@ main(int argc, char *argv[])
 
     daemonize_start();
 
-    VLOG_INFO("%s (Open vSwitch) %s", program_name, VERSION);
-
     if (want_mlockall) {
 #ifdef HAVE_MLOCKALL
         if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
@@ -97,6 +95,8 @@ main(int argc, char *argv[])
 #endif
     }
 
+    worker_start();
+
     retval = unixctl_server_create(unixctl_path, &unixctl);
     if (retval) {
         exit(EXIT_FAILURE);
@@ -108,6 +108,7 @@ main(int argc, char *argv[])
 
     exiting = false;
     while (!exiting) {
+        worker_run();
         if (signal_poll(sighup)) {
             vlog_reopen_log_file();
         }
@@ -126,6 +127,7 @@ main(int argc, char *argv[])
         unixctl_server_run(unixctl);
         netdev_run();
 
+        worker_wait();
         signal_wait(sighup);
         memory_wait();
         bridge_wait();
@@ -157,7 +159,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp)
         OPT_DISABLE_SYSTEM,
         DAEMON_OPTION_ENUMS
     };
-    static struct option long_options[] = {
+    static const struct option long_options[] = {
         {"help",        no_argument, NULL, 'h'},
         {"version",     no_argument, NULL, 'V'},
         {"mlockall",    no_argument, NULL, OPT_MLOCKALL},