Rev 6177: Track client_info so that we can add it to the debug info. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-hanging-tests

John Arbash Meinel john at arbash-meinel.com
Fri Sep 30 11:09:15 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.5-hanging-tests

------------------------------------------------------------
revno: 6177
revision-id: john at arbash-meinel.com-20110930110851-nt137tj1c4tyloyy
parent: john at arbash-meinel.com-20110929150907-oe2x2fkfb4lx1dpv
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-hanging-tests
timestamp: Fri 2011-09-30 13:08:51 +0200
message:
  Track client_info so that we can add it to the debug info.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2011-09-29 15:09:07 +0000
+++ b/bzrlib/smart/medium.py	2011-09-30 11:08:51 +0000
@@ -220,6 +220,7 @@
             raise AssertionError('You must supply a timeout.')
         self._client_timeout = timeout
         self._client_poll_timeout = min(timeout / 10.0, 1.0)
+        self._client_info = '<unknown>'
         SmartMedium.__init__(self)
 
     def serve(self):
@@ -319,9 +320,11 @@
                 raise
         if rs or xs:
             return
-        trace.mutter('Waited %.3fs for client.' % (self._timer() - t_start,))
-        raise errors.ConnectionTimeout('disconnecting client after %.1f seconds'
-                                       % (timeout_seconds,))
+        trace.mutter('Waited %.3fs for client: %s'
+                     % (self._timer() - t_start, self._client_info))
+        raise errors.ConnectionTimeout(
+            'disconnecting client (%s) after %.1f seconds'
+            % (self._client_info, timeout_seconds))
 
     def _serve_one_request(self, protocol):
         """Read one request from input, process, send back a response.
@@ -365,7 +368,7 @@
         try:
             self._client_info = sock.getpeername()
         except socket.error:
-            self._client_info = '<unknown>'
+            pass # Set to '<unknown>' in the base class
 
     def __str__(self):
         return '%s(client=%s)' % (self.__class__.__name__, self._client_info)



More information about the bazaar-commits mailing list