Only clean context if it exists

Prevents an attribute error
This commit is contained in:
Mike Place 2015-09-28 09:44:27 -06:00
parent d4d96bb3fc
commit 7367a4e32b

View file

@ -312,7 +312,8 @@ class AsyncZeroMQPubChannel(salt.transport.mixins.auth.AESPubClientMixin, salt.t
# TODO: Optionally call stream.close() on newer pyzmq? Its broken on some
self._stream.io_loop.remove_handler(self._stream.socket)
self._stream.socket.close(0)
self.context.term()
if hasattr(self, 'context'):
self.context.term()
def __del__(self):
self.destroy()