mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-09 06:16:10 +02:00
bgp: make 'core.reset_neighbor' API asynchronously
'core.reset_neighbor' was synchronous API and the caller had to wait until neighbor comes up. This behavior doesn't work well with rpc_cli. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
eb90b2ecc8
commit
e51f1dcf5a
@ -69,10 +69,13 @@ def reset_neighor(ip_address):
|
||||
if neigh_conf.enabled:
|
||||
# Disable neighbor to close existing session.
|
||||
neigh_conf.enabled = False
|
||||
# Yield here so that we give chance for neighbor to be disabled.
|
||||
hub.sleep(NEIGHBOR_RESET_WAIT_TIME)
|
||||
# Enable neighbor, so that we have a new session with it.
|
||||
neigh_conf.enabled = True
|
||||
# Enable neighbor after NEIGHBOR_RESET_WAIT_TIME
|
||||
# this API works asynchronously
|
||||
# it's recommended to check it really reset neighbor later
|
||||
|
||||
def up():
|
||||
neigh_conf.enabled = True
|
||||
hub.spawn_after(NEIGHBOR_RESET_WAIT_TIME, up)
|
||||
else:
|
||||
raise RuntimeConfigError('Neighbor %s is not enabled, hence cannot'
|
||||
' reset.' % ip_address)
|
||||
|
||||
@ -94,7 +94,7 @@ class RpcSession(Activity):
|
||||
"""
|
||||
|
||||
def __init__(self, socket, outgoing_msg_sink_iter):
|
||||
super(RpcSession, self).__init__()
|
||||
super(RpcSession, self).__init__("RpcSession(%s)" % socket)
|
||||
import msgpack
|
||||
|
||||
self._packer = msgpack.Packer()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user