Rev 3412: Nicer error when smart server started on an address already in use in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 7 11:05:05 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3412
revision-id:pqm at pqm.ubuntu.com-20080507100452-ya8ofjjd5f5pb9q7
parent: pqm at pqm.ubuntu.com-20080507084835-066pb8ddwett0ne3
parent: ian.clatworthy at canonical.com-20080507061952-drb871eni5ajwol4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-05-07 11:04:52 +0100
message:
  Nicer error when smart server started on an address already in use
  	(Andrea Corbellini)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
    ------------------------------------------------------------
    revno: 3408.4.1
    revision-id:ian.clatworthy at canonical.com-20080507061952-drb871eni5ajwol4
    parent: pqm at pqm.ubuntu.com-20080506114010-jwclr2qtiekvawjg
    parent: andrea.corbellini at beeseek.org-20080414193344-ebnhde4x27g7ocgg
    committer: Ian Clatworthy <ian.clatworthy at canonical.com>
    branch nick: ianc-integration
    timestamp: Wed 2008-05-07 16:19:52 +1000
    message:
      Nicer error when smart server started on an address already in use (Andrea Corbellini)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
    ------------------------------------------------------------
    revno: 3365.1.1
    revision-id:andrea.corbellini at beeseek.org-20080414193344-ebnhde4x27g7ocgg
    parent: pqm at pqm.ubuntu.com-20080413194429-a5e4pft9sffa2ycu
    committer: Andrea Corbellini <andrea.corbellini at beeseek.org>
    branch nick: bzr
    timestamp: Mon 2008-04-14 21:33:44 +0200
    message:
      Handle errors raised by socket.bind() (bug 200575)
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
=== modified file 'NEWS'
--- a/NEWS	2008-05-07 05:09:19 +0000
+++ b/NEWS	2008-05-07 10:04:52 +0000
@@ -24,6 +24,9 @@
     * Diff now handles revision specs like "branch:" and "submit:" more
       efficiently.  (Aaron Bentley)
 
+    * More friendly error given when attempt to start the smart server
+      on an address already in use. (Andrea Corbellini, #200575)
+
     * Pull completes much faster when there is nothing to pull.
       (Aaron Bentley)
 

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2008-05-02 07:31:24 +0000
+++ b/bzrlib/errors.py	2008-05-07 10:04:52 +0000
@@ -2667,3 +2667,12 @@
         self.path = path
         self.kind = kind
         self.user_encoding = osutils.get_user_encoding()
+
+
+class CannotBindAddress(BzrError):
+
+    _fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
+
+    def __init__(self, host, port, orig_error):
+        BzrError.__init__(self, host=host, port=port,
+            orig_error=orig_error[1])

=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py	2008-04-29 13:43:40 +0000
+++ b/bzrlib/smart/server.py	2008-05-07 06:19:52 +0000
@@ -64,7 +64,10 @@
         if sys.platform != 'win32':
             self._server_socket.setsockopt(socket.SOL_SOCKET,
                 socket.SO_REUSEADDR, 1)
-        self._server_socket.bind((host, port))
+        try:
+            self._server_socket.bind((host, port))
+        except self._socket_error, message:
+            raise errors.CannotBindAddress(host, port, message)
         self._sockname = self._server_socket.getsockname()
         self.port = self._sockname[1]
         self._server_socket.listen(1)




More information about the bazaar-commits mailing list