ws_topology: Handle WebSocket disconnection
Signed-off-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
e1cd4325eb
commit
6650a97d8d
@ -34,6 +34,7 @@ $ sudo mn --controller=remote --topo linear,2
|
||||
...
|
||||
"""
|
||||
|
||||
from socket import error as SocketError
|
||||
from tinyrpc.exc import InvalidReplyError
|
||||
|
||||
from ryu.app.wsgi import (
|
||||
@ -88,6 +89,9 @@ class WebSocketTopology(app_manager.RyuApp):
|
||||
rpc_server = rpc_client.get_proxy()
|
||||
try:
|
||||
getattr(rpc_server, func_name)(msg)
|
||||
except SocketError:
|
||||
self.logger.debug('WebSocket disconnected: %s' % rpc_client.ws)
|
||||
self.rpc_clients.remove(rpc_client)
|
||||
except InvalidReplyError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user