~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-15 12:56:23 UTC
  • mto: (6133.4.49 2.5-soft-hangup-795025)
  • mto: This revision was merged to the branch mainline in revision 6170.
  • Revision ID: john@arbash-meinel.com-20110915125623-sxo3jk6d858alyzf
Expose --client-timeout to the command line, pass it through the layers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
349
349
            transport = _mod_transport.get_transport_from_url(expand_userdirs.get_url())
350
350
        self.transport = transport
351
351
 
352
 
    def _make_smart_server(self, host, port, inet):
353
 
        c = config.GlobalStack()
354
 
        timeout = c.get('server.client_timeout')
 
352
    def _make_smart_server(self, host, port, inet, timeout):
 
353
        if timeout is None:
 
354
            c = config.GlobalStack()
 
355
            timeout = c.get('server.client_timeout')
355
356
        if inet:
356
357
            smart_server = medium.SmartServerPipeStreamMedium(
357
358
                sys.stdin, sys.stdout, self.transport)
381
382
        ui.ui_factory = ui.SilentUIFactory()
382
383
        lockdir._DEFAULT_TIMEOUT_SECONDS = 0
383
384
 
384
 
    def set_up(self, transport, host, port, inet):
 
385
    def set_up(self, transport, host, port, inet, timeout):
385
386
        self._make_backing_transport(transport)
386
 
        self._make_smart_server(host, port, inet)
 
387
        self._make_smart_server(host, port, inet, timeout)
387
388
        self._change_globals()
388
389
 
389
390
    def tear_down(self):
390
391
        for cleanup in reversed(self.cleanups):
391
392
            cleanup()
392
393
 
393
 
def serve_bzr(transport, host=None, port=None, inet=False):
 
394
def serve_bzr(transport, host=None, port=None, inet=False, timeout=None):
394
395
    """This is the default implementation of 'bzr serve'.
395
396
 
396
397
    It creates a TCP or pipe smart server on 'transport, and runs it.  The
399
400
    """
400
401
    bzr_server = BzrServerFactory()
401
402
    try:
402
 
        bzr_server.set_up(transport, host, port, inet)
 
403
        bzr_server.set_up(transport, host, port, inet, timeout)
403
404
        bzr_server.smart_server.serve()
404
405
    except:
405
406
        hook_caught_exception = False