On Wed, Oct 21, 2015 at 09:45:30PM -0700, Andy Zhou wrote:
> Add support for monitor2. When idl starts to run, monitor2 will be
> attempted first. In case the server is an older version that does
> not recognize monitor2.  IDL will then fall back to use "monitor"
> method.
> 
> Signed-off-by: Andy Zhou <az...@nicira.com>

One more thing, there's a bit of code that can be factored out of two
switch cases into common code:

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 1a30ad4..0a0c73a 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -358,11 +358,12 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
         } else if (msg->type == JSONRPC_REPLY
                    && idl->request_id
                    && json_equal(idl->request_id, msg->id)) {
+            json_destroy(idl->request_id);
+            idl->request_id = NULL;
+
             switch (idl->state) {
             case IDL_S_SCHEMA_REQUESTED:
                 /* Reply to our "get_schema" request. */
-                json_destroy(idl->request_id);
-                idl->request_id = NULL;
                 idl->schema = json_clone(msg->result);
                 ovsdb_idl_send_monitor2_request(idl);
                 idl->state = IDL_S_MONITOR2_REQUESTED;
@@ -372,8 +373,6 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
             case IDL_S_MONITOR2_REQUESTED:
                 /* Reply to our "monitor" or "monitor2" request. */
                 idl->change_seqno++;
-                json_destroy(idl->request_id);
-                idl->request_id = NULL;
                 ovsdb_idl_clear(idl);
                 if (idl->state == IDL_S_MONITOR_REQUESTED) {
                     idl->state = IDL_S_MONITORING;
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to