diff options
-rw-r--r-- | ryu/services/protocols/ovsdb/client.py | 6 | ||||
-rw-r--r-- | ryu/services/protocols/ovsdb/manager.py | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ryu/services/protocols/ovsdb/client.py b/ryu/services/protocols/ovsdb/client.py index 175936ca..64a8bfcb 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 b34fb7d3..4081eea1 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 |