Rev 2385: Review comments. in file:///home/robertc/source/baz/hpss-hooks/
Robert Collins
robertc at robertcollins.net
Thu Apr 5 07:59:21 BST 2007
At file:///home/robertc/source/baz/hpss-hooks/
------------------------------------------------------------
revno: 2385
revision-id: robertc at robertcollins.net-20070405065917-mu99paqftpq55f5m
parent: robertc at robertcollins.net-20070405003903-u1ys8t2lo5gs6b35
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss-hooks
timestamp: Thu 2007-04-05 16:59:17 +1000
message:
Review comments.
modified:
bzrlib/transport/smart.py ssh.py-20060608202016-c25gvf1ob7ypbus6-1
=== modified file 'bzrlib/transport/smart.py'
--- a/bzrlib/transport/smart.py 2007-04-05 00:39:03 +0000
+++ b/bzrlib/transport/smart.py 2007-04-05 06:59:17 +0000
@@ -836,8 +836,13 @@
:param host: Name of the interface to listen on.
:param port: TCP port to listen on, or 0 to allocate a transient port.
"""
+ # let connections timeout so that we get a chance to terminate
+ # Keep a reference to the exceptions we want to catch because the socket
+ # module's globals get set to None during interpreter shutdown.
+ from socket import timeout as socket_timeout
from socket import error as socket_error
self._socket_error = socket_error
+ self._socket_timeout = socket_timeout
self._server_socket = socket.socket()
self._server_socket.bind((host, port))
self._sockname = self._server_socket.getsockname()
@@ -849,10 +854,6 @@
self._stopped = threading.Event()
def serve(self):
- # let connections timeout so that we get a chance to terminate
- # Keep a reference to the exceptions we want to catch because the socket
- # module's globals get set to None during interpreter shutdown.
- from socket import timeout as socket_timeout
self._should_terminate = False
for hook in SmartTCPServer.hooks['server_started']:
hook(self.backing_transport.base, self.get_url())
@@ -862,7 +863,7 @@
while not self._should_terminate:
try:
conn, client_addr = self._server_socket.accept()
- except socket_timeout:
+ except self._socket_timeout:
# just check if we're asked to stop
pass
except self._socket_error, e:
More information about the bazaar-commits
mailing list