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

Aaron Bentley aaron at aaronbentley.com
Mon Apr 21 03:03:37 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> +++ bzrlib/smart/server.py	2008-04-21 01:07:17 +0000
> @@ -1,4 +1,4 @@
> -# Copyright (C) 2006, 2007 Canonical Ltd
> +# Copyright (C) 2006, 2007, 2008 Canonical Ltd
>  #
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -18,6 +18,7 @@
>  
>  import errno
>  import socket
> +import sys
>  import threading
>  
>  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?

Aside from that, I'm not really qualified to comment.

Aaron

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIC/X50F+nu1YWqI0RAm7IAJ95jd4ZDEufN0LRTYlXJx33Sw9lOwCfUP38
BcN8hzKaB8jxWgYMKfelEko=
=UvFF
-----END PGP SIGNATURE-----



More information about the bazaar mailing list