From: Ben Pfaff Date: Tue, 17 Nov 2009 00:18:02 +0000 (-0800) Subject: ovsdb-server: Ignore replies to echo requests. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22f156fd06afb565c90ac9346d35a30612ba88e5;p=openvswitch ovsdb-server: Ignore replies to echo requests. Until this commit, ovsdb-server would send off echo requests when the connection became idle, but then it would terminate the connection when the reply arrived, because it didn't recognize that it was a reply to its own request (!). --- diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index a42696ac..977d3024 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -260,6 +260,10 @@ ovsdb_jsonrpc_session_run(struct ovsdb_jsonrpc_session *s) ovsdb_jsonrpc_session_got_request(s, msg); } else if (msg->type == JSONRPC_NOTIFY) { ovsdb_jsonrpc_session_got_notify(s, msg); + } else if (msg->type == JSONRPC_REPLY + && msg->id && msg->id->type == JSON_STRING + && !strcmp(msg->id->u.string, "echo")) { + /* It's a reply to our echo request. Ignore it. */ } else { VLOG_WARN("%s: received unexpected %s message", jsonrpc_get_name(s->rpc), @@ -301,8 +305,14 @@ ovsdb_jsonrpc_session_run(struct ovsdb_jsonrpc_session *s) case RECONNECT_PROBE: if (s->rpc) { - struct json *params = json_array_create_empty(); - jsonrpc_send(s->rpc, jsonrpc_create_request("echo", params)); + struct json *params; + struct jsonrpc_msg *request; + + params = json_array_create_empty(); + request = jsonrpc_create_request("echo", params); + json_destroy(request->id); + request->id = json_string_create("echo"); + jsonrpc_send(s->rpc, request); } break; }