Rev 6154: I'm trying to make sure that 'bzr serve' supports the serve.client_timeout code. in http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797
John Arbash Meinel
john at arbash-meinel.com
Thu Sep 15 11:48:09 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797
------------------------------------------------------------
revno: 6154
revision-id: john at arbash-meinel.com-20110915114755-oe2a1u6oq4g3edln
parent: john at arbash-meinel.com-20110915113739-ktb612ayprk49pza
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: drop-idle-connections-824797
timestamp: Thu 2011-09-15 13:47:55 +0200
message:
I'm trying to make sure that 'bzr serve' supports the serve.client_timeout code.
However, the 'test this by running a smart server' requires signals which I can't test
on Windows.
-------------- next part --------------
=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py 2011-09-15 11:37:39 +0000
+++ b/bzrlib/smart/server.py 2011-09-15 11:47:55 +0000
@@ -360,7 +360,8 @@
host = medium.BZR_DEFAULT_INTERFACE
if port is None:
port = medium.BZR_DEFAULT_PORT
- smart_server = SmartTCPServer(self.transport)
+ smart_server = SmartTCPServer(self.transport,
+ client_timeout=timeout)
smart_server.start_server(host, port)
trace.note('listening on port: %s' % smart_server.port)
self.smart_server = smart_server
=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py 2011-08-19 22:34:02 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py 2011-09-15 11:47:55 +0000
@@ -22,9 +22,11 @@
import sys
import thread
import threading
+import time
from bzrlib import (
builtins,
+ config,
errors,
osutils,
revision as _mod_revision,
@@ -266,6 +268,21 @@
f.close()
self.assertContainsRe(content, r'hpss request: \[[0-9-]+\]')
+ def test_bzr_serve_supports_configurable_timeout(self):
+ gs = config.GlobalStack()
+ gs.set('server.client_timeout', 1)
+ process, url = self.start_server_port()
+ self.build_tree_contents([('a_file', 'contents\n')])
+ # We can connect and issue a request
+ t = transport.get_transport_from_url(url)
+ self.assertEqual('contents\n', t.get_bytes())
+ m = t.get_smart_medium()
+ # However, if we just wait for more content from the server, it will
+ # eventually disconnect us.
+ m.read_bytes()
+ # Now, we wait for timeout to trigger
+ self.assertServerFinishesCleanly(process)
+
class TestCmdServeChrooting(TestBzrServeBase):
More information about the bazaar-commits
mailing list