aqctl_moninj_proxy: clear listeners on disconnect

This commit is contained in:
Deepskyhunter 2022-07-07 17:20:08 +08:00 committed by GitHub
parent 7aa6104872
commit c7394802bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,6 +116,9 @@ class MonitorMux:
else:
raise ValueError
def disconnect_cb(self):
self.listeners.clear()
class ProxyConnection:
def __init__(self, monitor_mux, reader, writer):
@ -203,7 +206,9 @@ def main():
signal_handler.setup()
try:
monitor_mux = MonitorMux()
comm_moninj = CommMonInj(monitor_mux.monitor_cb, monitor_mux.injection_status_cb)
comm_moninj = CommMonInj(monitor_mux.monitor_cb,
monitor_mux.injection_status_cb,
monitor_mux.disconnect_cb)
monitor_mux.comm_moninj = comm_moninj
loop.run_until_complete(comm_moninj.connect(args.core_addr))
try: