~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-09 20:23:07 UTC
  • mfrom: (4265.1.4 bbc-merge)
  • Revision ID: pqm@pqm.ubuntu.com-20090409202307-n0depb16qepoe21o
(jam) Change _fetch_uses_deltas = False for CHK repos until we can
        write a better fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            pass
112
112
        for hook in SmartTCPServer.hooks['server_started']:
113
113
            hook(backing_urls, self.get_url())
114
 
        for hook in SmartTCPServer.hooks['server_started_ex']:
115
 
            hook(backing_urls, self)
116
114
        self._started.set()
117
115
        try:
118
116
            try:
216
214
            "where backing_url is a list of URLs giving the "
217
215
            "server-specific directory locations, and public_url is the "
218
216
            "public URL for the directory being served.", (0, 16), None))
219
 
        self.create_hook(HookPoint('server_started_ex',
220
 
            "Called by the bzr server when it starts serving a directory. "
221
 
            "server_started is called with (backing_urls, server_obj).",
222
 
            (1, 17), None))
223
217
        self.create_hook(HookPoint('server_stopped',
224
218
            "Called by the bzr server when it stops serving a directory. "
225
219
            "server_stopped is called with the same parameters as the "
313
307
        return transport.get_transport(url)
314
308
 
315
309
 
316
 
def serve_bzr(transport, host=None, port=None, inet=False):
317
 
    from bzrlib import lockdir, ui
318
 
    from bzrlib.transport import get_transport
319
 
    from bzrlib.transport.chroot import ChrootServer
320
 
    chroot_server = ChrootServer(transport)
321
 
    chroot_server.setUp()
322
 
    transport = get_transport(chroot_server.get_url())
323
 
    if inet:
324
 
        smart_server = medium.SmartServerPipeStreamMedium(
325
 
            sys.stdin, sys.stdout, transport)
326
 
    else:
327
 
        if host is None:
328
 
            host = medium.BZR_DEFAULT_INTERFACE
329
 
        if port is None:
330
 
            port = medium.BZR_DEFAULT_PORT
331
 
        smart_server = SmartTCPServer(transport, host=host, port=port)
332
 
        trace.note('listening on port: %s' % smart_server.port)
333
 
    # For the duration of this server, no UI output is permitted. note
334
 
    # that this may cause problems with blackbox tests. This should be
335
 
    # changed with care though, as we dont want to use bandwidth sending
336
 
    # progress over stderr to smart server clients!
337
 
    old_factory = ui.ui_factory
338
 
    old_lockdir_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
339
 
    try:
340
 
        ui.ui_factory = ui.SilentUIFactory()
341
 
        lockdir._DEFAULT_TIMEOUT_SECONDS = 0
342
 
        smart_server.serve()
343
 
    finally:
344
 
        ui.ui_factory = old_factory
345
 
        lockdir._DEFAULT_TIMEOUT_SECONDS = old_lockdir_timeout
346