Show More
@@ -599,7 +599,6 b' class Client(HasTraits):' | |||
|
599 | 599 | self._connected=True |
|
600 | 600 | |
|
601 | 601 | def connect_socket(s, url): |
|
602 | # url = util.disambiguate_url(url, self._config['location']) | |
|
603 | 602 | if self._ssh: |
|
604 | 603 | return tunnel.tunnel_connection(s, url, sshserver, **ssh_kwargs) |
|
605 | 604 | else: |
@@ -956,14 +955,23 b' class Client(HasTraits):' | |||
|
956 | 955 | view.activate(suffix) |
|
957 | 956 | return view |
|
958 | 957 | |
|
959 | def close(self): | |
|
958 | def close(self, linger=None): | |
|
959 | """Close my zmq Sockets | |
|
960 | ||
|
961 | If `linger`, set the zmq LINGER socket option, | |
|
962 | which allows discarding of messages. | |
|
963 | """ | |
|
960 | 964 | if self._closed: |
|
961 | 965 | return |
|
962 | 966 | self.stop_spin_thread() |
|
963 | snames = filter(lambda n: n.endswith('socket'), dir(self)) | |
|
964 | for socket in map(lambda name: getattr(self, name), snames): | |
|
965 | if isinstance(socket, zmq.Socket) and not socket.closed: | |
|
966 |
socket.close |
|
|
967 | snames = [ trait for trait in self.trait_names() if trait.endswith("socket") ] | |
|
968 | for name in snames: | |
|
969 | socket = getattr(self, name) | |
|
970 | if socket is not None and not socket.closed: | |
|
971 | if linger is not None: | |
|
972 | socket.close(linger=linger) | |
|
973 | else: | |
|
974 | socket.close() | |
|
967 | 975 | self._closed = True |
|
968 | 976 | |
|
969 | 977 | def _spin_every(self, interval=1): |
General Comments 0
You need to be logged in to leave comments.
Login now