Signed-off-by: Jason Kölker <[email protected]>
---
 ryu/services/protocols/ovsdb/client.py  | 6 +++++-
 ryu/services/protocols/ovsdb/manager.py | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ryu/services/protocols/ovsdb/client.py 
b/ryu/services/protocols/ovsdb/client.py
index 175936c..64a8bfc 100644
--- a/ryu/services/protocols/ovsdb/client.py
+++ b/ryu/services/protocols/ovsdb/client.py
@@ -97,7 +97,7 @@ def discover_schemas(connection):
 def discover_system_id(idl):
     system_id = None
 
-    while system_id is None:
+    while system_id is None and idl._session.is_connected():
         idl.run()
         openvswitch = idl.tables['Open_vSwitch'].rows
 
@@ -211,6 +211,10 @@ class RemoteOvsdb(app_manager.RyuApp):
         idl = Idl(session, schemas[0])
 
         system_id = discover_system_id(idl)
+
+        if not system_id:
+            return None
+
         name = cls.instance_name(system_id)
         ovs_stream.name = name
         connection.name = name
diff --git a/ryu/services/protocols/ovsdb/manager.py 
b/ryu/services/protocols/ovsdb/manager.py
index b34fb7d..4081eea 100644
--- a/ryu/services/protocols/ovsdb/manager.py
+++ b/ryu/services/protocols/ovsdb/manager.py
@@ -91,6 +91,10 @@ class OVSDB(app_manager.RyuApp):
             ev = event.EventNewOVSDBConnection(app.system_id)
             self.send_event_to_observers(ev)
 
+        else:
+            sock.shutdown(socket.SHUT_RDWR)
+            sock.close()
+
     def start(self):
         server = hub.listen((self._address, self._port))
         key = self.CONF.ovsdb.mngr_privkey or self.CONF.ctl_privkey
-- 
2.4.3


------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to