/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/smart/server.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import time
26
26
import threading
27
27
 
28
 
from bzrlib.hooks import Hooks
29
 
from bzrlib import (
 
28
from ..hooks import Hooks
 
29
from .. import (
30
30
    errors,
31
31
    trace,
32
32
    transport as _mod_transport,
33
33
)
34
 
from bzrlib.i18n import gettext
35
 
from bzrlib.lazy_import import lazy_import
 
34
from ..i18n import gettext
 
35
from ..lazy_import import lazy_import
36
36
lazy_import(globals(), """
37
 
from bzrlib.smart import (
 
37
from breezy.smart import (
38
38
    medium,
39
39
    signals,
40
40
    )
41
 
from bzrlib.transport import (
 
41
from breezy.transport import (
42
42
    chroot,
43
43
    pathfilter,
44
44
    )
45
 
from bzrlib import (
 
45
from breezy import (
46
46
    config,
47
47
    urlutils,
48
48
    )
113
113
                socket.SO_REUSEADDR, 1)
114
114
        try:
115
115
            self._server_socket.bind(sockaddr)
116
 
        except self._socket_error, message:
 
116
        except self._socket_error as message:
117
117
            raise errors.CannotBindAddress(host, port, message)
118
118
        self._sockname = self._server_socket.getsockname()
119
119
        self.port = self._sockname[1]
210
210
                    except self._socket_timeout:
211
211
                        # just check if we're asked to stop
212
212
                        pass
213
 
                    except self._socket_error, e:
 
213
                    except self._socket_error as e:
214
214
                        # if the socket is closed by stop_background_thread
215
215
                        # we might get a EBADF here, or if we get a signal we
216
216
                        # can get EINTR, any other socket errors should get
228
228
            except KeyboardInterrupt:
229
229
                # dont log when CTRL-C'd.
230
230
                raise
231
 
            except Exception, e:
 
231
            except Exception as e:
232
232
                trace.report_exception(sys.exc_info(), sys.stderr)
233
233
                raise
234
234
        finally:
329
329
        These are all empty initially, because by default nothing should get
330
330
        notified.
331
331
        """
332
 
        Hooks.__init__(self, "bzrlib.smart.server", "SmartTCPServer.hooks")
 
332
        Hooks.__init__(self, "breezy.smart.server", "SmartTCPServer.hooks")
333
333
        self.add_hook('server_started',
334
334
            "Called by the bzr server when it starts serving a directory. "
335
335
            "server_started is called with (backing urls, public url), "
453
453
        self.smart_server = smart_server
454
454
 
455
455
    def _change_globals(self):
456
 
        from bzrlib import lockdir, ui
 
456
        from breezy import lockdir, ui
457
457
        # For the duration of this server, no UI output is permitted. note
458
458
        # that this may cause problems with blackbox tests. This should be
459
459
        # changed with care though, as we dont want to use bandwidth sending