~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

  • Committer: Andrew Bennetts
  • Date: 2007-12-13 22:22:58 UTC
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20071213222258-mh7mq5gtxqn4yceb
All WSGI tests passing, and manual testing works too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    hooks: An instance of SmartServerHooks.
39
39
    """
40
40
 
41
 
    def __init__(self, backing_transport, host='127.0.0.1', port=0):
 
41
    def __init__(self, backing_transport, host='127.0.0.1', port=0,
 
42
                 root_client_path='/'):
42
43
        """Construct a new server.
43
44
 
44
45
        To actually start it running, call either start_background_thread or
45
46
        serve.
46
47
 
 
48
        :param backing_transport: The transport to serve.
47
49
        :param host: Name of the interface to listen on.
48
50
        :param port: TCP port to listen on, or 0 to allocate a transient port.
 
51
        :param root_client_path: The client path that will correspond to root
 
52
            of backing_transport.
49
53
        """
50
54
        # let connections timeout so that we get a chance to terminate
51
55
        # Keep a reference to the exceptions we want to catch because the socket
63
67
        self.backing_transport = backing_transport
64
68
        self._started = threading.Event()
65
69
        self._stopped = threading.Event()
66
 
        self.root_client_path = '/'
 
70
        self.root_client_path = root_client_path
67
71
 
68
72
    def serve(self):
69
73
        self._should_terminate = False