"use --help for usage");
}
- retval = vlog_server_listen(NULL, NULL);
- if (retval) {
- ofp_fatal(retval, "Could not listen for vlog connections");
- }
-
n_switches = n_listeners = 0;
for (i = optind; i < argc; i++) {
const char *name = argv[i];
die_if_already_running();
daemonize();
+ retval = vlog_server_listen(NULL, NULL);
+ if (retval) {
+ ofp_fatal(retval, "Could not listen for vlog connections");
+ }
+
while (n_switches > 0 || n_listeners > 0) {
int iteration;
int i;
* - An absolute path (starting with '/') that gives the exact name of
* the Unix domain socket to listen on.
*
+ * A program that (optionally) daemonizes itself should call this function
+ * *after* daemonization, so that the socket name contains the pid of the
+ * daemon instead of the pid of the program that exited. (Otherwise, "vlogconf
+ * --target <program>.pid" will fail.)
+ *
* Returns 0 if successful, otherwise a positive errno value. If successful,
* sets '*serverp' to the new vlog_server, otherwise to NULL. */
int
/* Initialize switch status hook. */
switch_status_start(&secchan, &s, &switch_status);
+ die_if_already_running();
+ daemonize();
+
/* Start listening for vlogconf requests. */
retval = vlog_server_listen(NULL, NULL);
if (retval) {
ofp_fatal(retval, "Could not listen for vlog connections");
}
- die_if_already_running();
- daemonize();
-
VLOG_WARN("OpenFlow reference implementation version %s", VERSION BUILDNR);
VLOG_WARN("OpenFlow protocol version 0x%02x", OFP_VERSION);
add_ports(dp, port_list);
}
+ die_if_already_running();
+ daemonize();
+
error = vlog_server_listen(NULL, NULL);
if (error) {
ofp_fatal(error, "could not listen for vlog connections");
}
- die_if_already_running();
- daemonize();
-
for (;;) {
dp_run(dp);
dp_wait(dp);