aboutsummaryrefslogtreecommitdiff
path: root/lib/jsonrpc.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-03-18 12:59:34 -0700
committerBen Pfaff <blp@nicira.com>2010-04-12 11:15:15 -0700
commit0d11f523a371910cb0ed5549a85836f83a7552c2 (patch)
tree6bef7f1ccdadfa5f2025a687350fb01a200b26d8 /lib/jsonrpc.c
parentf39dc942afd5fe241903aada30850a1d96122c8c (diff)
ovsdb: Use port 6632 as a default port for database connections.
Until now we have required a port number to be specified explicitly for database connections. This commit adopts port 6632 as a default.
Diffstat (limited to 'lib/jsonrpc.c')
-rw-r--r--lib/jsonrpc.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index f0ac27bc..72590a2f 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -56,6 +56,24 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
static void jsonrpc_received(struct jsonrpc *);
static void jsonrpc_cleanup(struct jsonrpc *);
+/* This is just the same as stream_open() except that it uses the default
+ * JSONRPC ports if none is specified. */
+int
+jsonrpc_stream_open(const char *name, struct stream **streamp)
+{
+ return stream_open_with_default_ports(name, JSONRPC_TCP_PORT,
+ JSONRPC_SSL_PORT, streamp);
+}
+
+/* This is just the same as pstream_open() except that it uses the default
+ * JSONRPC ports if none is specified. */
+int
+jsonrpc_pstream_open(const char *name, struct pstream **pstreamp)
+{
+ return pstream_open_with_default_ports(name, JSONRPC_TCP_PORT,
+ JSONRPC_SSL_PORT, pstreamp);
+}
+
struct jsonrpc *
jsonrpc_open(struct stream *stream)
{
@@ -727,12 +745,12 @@ jsonrpc_session_connect(struct jsonrpc_session *s)
jsonrpc_session_disconnect(s);
if (!reconnect_is_passive(s->reconnect)) {
- error = stream_open(name, &s->stream);
+ error = jsonrpc_stream_open(name, &s->stream);
if (!error) {
reconnect_connecting(s->reconnect, time_msec());
}
} else {
- error = s->pstream ? 0 : pstream_open(name, &s->pstream);
+ error = s->pstream ? 0 : jsonrpc_pstream_open(name, &s->pstream);
if (!error) {
reconnect_listening(s->reconnect, time_msec());
}