Rev 6177: Rename _close to _disconnect_client. This makes it more obvious. in http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

John Arbash Meinel john at arbash-meinel.com
Fri Sep 23 13:00:13 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

------------------------------------------------------------
revno: 6177
revision-id: john at arbash-meinel.com-20110923130004-30sc1g5p6x2mb00b
parent: john at arbash-meinel.com-20110923124021-0hve5zjdw81ix72c
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: drop-idle-connections-824797
timestamp: Fri 2011-09-23 15:00:04 +0200
message:
  Rename _close to _disconnect_client. This makes it more obvious.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2011-09-22 11:51:16 +0000
+++ b/bzrlib/smart/medium.py	2011-09-23 13:00:04 +0000
@@ -231,14 +231,14 @@
         except errors.ConnectionTimeout, e:
             trace.note('%s' % (e,))
             trace.log_exception_quietly()
-            self._close()
+            self._disconnect_client()
             # We reported it, no reason to make a big fuss.
             return
         except Exception, e:
             stderr.write("%s terminating on exception %s\n" % (self, e))
             raise
 
-    def _close(self):
+    def _disconnect_client(self):
         """Close the current connection. We stopped due to a timeout/etc."""
         # The default implementation is a no-op, because that is all we used to
         # do when disconnecting from a client. I suppose we never had the
@@ -354,7 +354,7 @@
 
         self._push_back(protocol.unused_data)
 
-    def _close(self):
+    def _disconnect_client(self):
         """Close the current connection. We stopped due to a timeout/etc."""
         self.socket.close()
 
@@ -429,7 +429,7 @@
                 return
             protocol.accept_bytes(bytes)
 
-    def _close(self):
+    def _disconnect_client(self):
         self._in.close()
         self._out.close()
 

=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2011-09-23 12:40:21 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2011-09-23 13:00:04 +0000
@@ -728,7 +728,7 @@
         sample_protocol = SampleRequest(expected_bytes=sample_request_bytes)
         client_sock.sendall(sample_request_bytes)
         server._serve_one_request(sample_protocol)
-        server._close()
+        server._disconnect_client()
         self.assertEqual('', client_sock.recv(1))
         self.assertEqual(sample_request_bytes, sample_protocol.accepted_bytes)
         self.assertFalse(server.finished)
@@ -762,7 +762,7 @@
         server_protocol = server._build_protocol()
         client_sock.sendall(rest_of_request_bytes)
         server._serve_one_request(server_protocol)
-        server._close()
+        server._disconnect_client()
         self.assertEqual(expected_response, osutils.recv_all(client_sock, 50),
                          "Not a version 2 response to 'hello' request.")
         self.assertEqual('', client_sock.recv(1))
@@ -841,7 +841,7 @@
         stream_still_open = server._serve_one_request(second_protocol)
         self.assertEqual(sample_request_bytes, second_protocol.accepted_bytes)
         self.assertFalse(server.finished)
-        server._close()
+        server._disconnect_client()
         self.assertEqual('', client_sock.recv(1))
 
     def test_pipe_like_stream_error_handling(self):
@@ -883,7 +883,7 @@
         fake_protocol = ErrorRaisingProtocol(KeyboardInterrupt('boom'))
         self.assertRaises(
             KeyboardInterrupt, server._serve_one_request, fake_protocol)
-        server._close()
+        server._disconnect_client()
         self.assertEqual('', client_sock.recv(1))
 
     def build_protocol_pipe_like(self, bytes):



More information about the bazaar-commits mailing list