103
104
# The URL that a commit done on the same machine as the server will
104
105
# have within the servers space. (e.g. file:///home/user/source)
105
106
# The URL that will be given to other hooks in the same process -
106
# the URL of the backing transport itself. (e.g. filtered-36195:///)
107
# the URL of the backing transport itself. (e.g. chroot+:///)
107
108
# We need all three because:
108
109
# * other machines see the first
109
110
# * local commits on this machine should be able to be mapped to
177
178
def get_url(self):
178
179
"""Return the url of the server"""
179
return "bzr://%s:%s/" % (self._sockname[0], self._sockname[1])
180
return "bzr://%s:%d/" % self._sockname
181
182
def serve_conn(self, conn, thread_name_suffix):
182
183
# For WIN32, where the timeout value from the listening socket
239
240
These are all empty initially, because by default nothing should get
242
Hooks.__init__(self, "bzrlib.smart.server", "SmartTCPServer.hooks")
243
self.add_hook('server_started',
244
self.create_hook(HookPoint('server_started',
244
245
"Called by the bzr server when it starts serving a directory. "
245
246
"server_started is called with (backing urls, public url), "
246
247
"where backing_url is a list of URLs giving the "
247
248
"server-specific directory locations, and public_url is the "
248
"public URL for the directory being served.", (0, 16))
249
self.add_hook('server_started_ex',
249
"public URL for the directory being served.", (0, 16), None))
250
self.create_hook(HookPoint('server_started_ex',
250
251
"Called by the bzr server when it starts serving a directory. "
251
252
"server_started is called with (backing_urls, server_obj).",
253
self.add_hook('server_stopped',
254
self.create_hook(HookPoint('server_stopped',
254
255
"Called by the bzr server when it stops serving a directory. "
255
256
"server_stopped is called with the same parameters as the "
256
"server_started hook: (backing_urls, public_url).", (0, 16))
257
"server_started hook: (backing_urls, public_url).", (0, 16), None))
258
259
SmartTCPServer.hooks = SmartServerHooks()