jsonrpc-server: refactoring ovsdb_jsonrpc_monitor_needs_flush
authorAndy Zhou <azhou@nicira.com>
Thu, 12 Mar 2015 02:33:46 +0000 (19:33 -0700)
committerAndy Zhou <azhou@nicira.com>
Sat, 30 May 2015 00:39:50 +0000 (17:39 -0700)
split out per monitoring needs_flush() into
ovsdb_monitor_needs_flush().

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovsdb/jsonrpc-server.c

index 9377388..23aa3fd 100644 (file)
@@ -1739,20 +1739,29 @@ ovsdb_jsonrpc_monitor_compose_table_update(
     return ovsdb_monitor_compose_table_update(monitor->dbmon, initial);
 }
 
+static bool
+ovsdb_monitor_needs_flush(struct ovsdb_monitor *dbmon)
+{
+    struct shash_node *node;
+
+    SHASH_FOR_EACH (node, &dbmon->tables) {
+        struct ovsdb_monitor_table *mt = node->data;
+
+        if (!hmap_is_empty(&mt->changes)) {
+            return true;
+        }
+    }
+    return false;
+}
+
 static bool
 ovsdb_jsonrpc_monitor_needs_flush(struct ovsdb_jsonrpc_session *s)
 {
     struct ovsdb_jsonrpc_monitor *m;
 
     HMAP_FOR_EACH (m, node, &s->monitors) {
-        struct shash_node *node;
-
-        SHASH_FOR_EACH (node, &m->dbmon->tables) {
-            struct ovsdb_monitor_table *mt = node->data;
-
-            if (!hmap_is_empty(&mt->changes)) {
-                return true;
-            }
+        if (ovsdb_monitor_needs_flush(m->dbmon)) {
+            return true;
         }
     }