[MERGE] Set SO_REUSEADDR on server sockets (#164288)

Martin Pool mbp at sourcefrog.net
Mon Apr 21 03:23:43 BST 2008


>  >  from bzrlib.hooks import Hooks
>  > @@ -59,6 +60,10 @@
>  >          self._socket_error = socket_error
>  >          self._socket_timeout = socket_timeout
>  >          self._server_socket = socket.socket()
>  > +        # SO_REUSERADDR has a different meaning on Windows
>  > +        if sys.platform != 'win32':
>  > +            self._server_socket.setsockopt(socket.SOL_SOCKET,
>  > +                socket.SO_REUSEADDR, 1)
>
>  ^^^ if this is platform-specific, perhaps it makes sense to factor it
>  out into osutils?

I think this particular function is too fine-grained to be worth
splitting out.  It would be better to split out the general "start a
tcp server" and make this part of that.  (Or maybe we should use one
of the SocketServer base classes; I don't want to look into it now.)
Good question though.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list