-/* Copyright (c) 2009, 2010, 2011 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
};
static struct ovsdb_jsonrpc_remote *ovsdb_jsonrpc_server_add_remote(
- struct ovsdb_jsonrpc_server *, const char *name);
+ struct ovsdb_jsonrpc_server *, const char *name,
+ const struct ovsdb_jsonrpc_options *options
+);
static void ovsdb_jsonrpc_server_del_remote(struct shash_node *);
struct ovsdb_jsonrpc_server *
}
struct ovsdb_jsonrpc_options *
-ovsdb_jsonrpc_default_options(void)
+ovsdb_jsonrpc_default_options(const char *target)
{
struct ovsdb_jsonrpc_options *options = xzalloc(sizeof *options);
- options->probe_interval = RECONNECT_DEFAULT_PROBE_INTERVAL;
options->max_backoff = RECONNECT_DEFAULT_MAX_BACKOFF;
+ options->probe_interval = (stream_or_pstream_needs_probes(target)
+ ? RECONNECT_DEFAULT_PROBE_INTERVAL
+ : 0);
return options;
}
remote = shash_find_data(&svr->remotes, node->name);
if (!remote) {
- remote = ovsdb_jsonrpc_server_add_remote(svr, node->name);
+ remote = ovsdb_jsonrpc_server_add_remote(svr, node->name, options);
if (!remote) {
continue;
}
static struct ovsdb_jsonrpc_remote *
ovsdb_jsonrpc_server_add_remote(struct ovsdb_jsonrpc_server *svr,
- const char *name)
+ const char *name,
+ const struct ovsdb_jsonrpc_options *options)
{
struct ovsdb_jsonrpc_remote *remote;
struct pstream *listener;
int error;
- error = jsonrpc_pstream_open(name, &listener);
+ error = jsonrpc_pstream_open(name, &listener, options->dscp);
if (error && error != EAFNOSUPPORT) {
VLOG_ERR_RL(&rl, "%s: listen failed: %s", name, strerror(error));
return NULL;
/* JSON-RPC database server session. */
struct ovsdb_jsonrpc_session {
+ struct list node; /* Element in remote's sessions list. */
struct ovsdb_session up;
struct ovsdb_jsonrpc_remote *remote;
- struct list node; /* Element in remote's sessions list. */
/* Triggers. */
struct hmap triggers; /* Hmap of "struct ovsdb_jsonrpc_trigger"s. */
{
jsonrpc_session_set_max_backoff(session->js, options->max_backoff);
jsonrpc_session_set_probe_interval(session->js, options->probe_interval);
+ jsonrpc_session_set_dscp(session->js, options->dscp);
}
static void