X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=ovsdb%2Fovsdb-server.c;h=00c465d76bcd833252c1c74efbb520ea6f6b6b0c;hb=b93d3b6cb28a925f530aef2009602c06f2f5ae60;hp=908042d77804676ce406e9ba8deec363c11b8551;hpb=434910dd2329aa16581532902ea494e5213a74bb;p=openvswitch diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 908042d7..00c465d7 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -24,6 +24,7 @@ #include "command-line.h" #include "daemon.h" #include "fault.h" +#include "file.h" #include "json.h" #include "jsonrpc.h" #include "jsonrpc-server.h" @@ -56,8 +57,10 @@ main(int argc, char *argv[]) struct svec active, passive; struct ovsdb_error *error; struct ovsdb *db; + const char *name; char *file_name; int retval; + size_t i; set_program_name(argv[0]); register_fault_handlers(); @@ -68,14 +71,20 @@ main(int argc, char *argv[]) parse_options(argc, argv, &file_name, &active, &passive); - error = ovsdb_open(file_name, false, &db); + error = ovsdb_file_open(file_name, false, &db); if (error) { ovs_fatal(0, "%s", ovsdb_error_to_string(error)); } - retval = ovsdb_jsonrpc_server_create(db, &active, &passive, &jsonrpc); - if (retval) { - ovs_fatal(retval, "failed to initialize JSON-RPC server for OVSDB"); + jsonrpc = ovsdb_jsonrpc_server_create(db); + SVEC_FOR_EACH (i, name, &active) { + ovsdb_jsonrpc_server_connect(jsonrpc, name); + } + SVEC_FOR_EACH (i, name, &passive) { + retval = ovsdb_jsonrpc_server_listen(jsonrpc, name); + if (retval) { + ovs_fatal(retval, "failed to listen on %s", name); + } } svec_destroy(&active); svec_destroy(&passive);