Adds set_close_callback function to removes stream instance after closed from a set streams.

This commit is contained in:
gwiyeong 2018-02-19 11:07:36 +09:00 committed by kstreee
parent c3a938e994
commit aba00805f4
No known key found for this signature in database
GPG Key ID: 43F5F108E2B7859E

View File

@ -559,6 +559,11 @@ class IPCMessagePublisher(object):
io_loop=self.io_loop io_loop=self.io_loop
) )
self.streams.add(stream) self.streams.add(stream)
def discard_after_closed():
self.streams.discard(stream)
stream.set_close_callback(discard_after_closed)
except Exception as exc: except Exception as exc:
log.error('IPC streaming error: {0}'.format(exc)) log.error('IPC streaming error: {0}'.format(exc))