X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-idl.c;h=4f547330cf1464708cc232bb020a42602520cba8;hb=56244b81016f4d60082976845f296f98111d16a3;hp=877fa3e284bfcb1cfea25b29059ff51db817ec77;hpb=b54e22e91eee43eb04ad53e2fa919be44f34e731;p=openvswitch diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 877fa3e2..4f547330 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009 Nicira Networks. +/* Copyright (c) 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -244,9 +244,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl) } reply = NULL; - if (msg->type == JSONRPC_REQUEST && !strcmp(msg->method, "echo")) { - reply = jsonrpc_create_reply(json_clone(msg->params), msg->id); - } else if (msg->type == JSONRPC_NOTIFY + if (msg->type == JSONRPC_NOTIFY && !strcmp(msg->method, "update") && msg->params->type == JSON_ARRAY && msg->params->u.array.n == 2 @@ -268,10 +266,12 @@ ovsdb_idl_run(struct ovsdb_idl *idl) && ovsdb_idl_txn_process_reply(idl, msg)) { /* ovsdb_idl_txn_process_reply() did everything needful. */ } else { - VLOG_WARN("%s: received unexpected %s message", - jsonrpc_session_get_name(idl->session), - jsonrpc_msg_type_to_string(msg->type)); - jsonrpc_session_force_reconnect(idl->session); + /* This can happen if ovsdb_idl_txn_destroy() is called to destroy + * a transaction before we receive the reply, so keep the log level + * low. */ + VLOG_DBG("%s: received unexpected %s message", + jsonrpc_session_get_name(idl->session), + jsonrpc_msg_type_to_string(msg->type)); } if (reply) { jsonrpc_session_send(idl->session, reply); @@ -293,6 +293,12 @@ ovsdb_idl_get_seqno(const struct ovsdb_idl *idl) return idl->change_seqno; } +bool +ovsdb_idl_has_ever_connected(const struct ovsdb_idl *idl) +{ + return ovsdb_idl_get_seqno(idl) != 0; +} + void ovsdb_idl_force_reconnect(struct ovsdb_idl *idl) { @@ -1123,6 +1129,7 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn) if (!any_updates) { txn->status = TXN_UNCHANGED; + json_destroy(operations); } else if (!jsonrpc_session_send( txn->idl->session, jsonrpc_create_request(