Rev 3375: (mbp) Set SO_REUSEADDR on server sockets (#164288) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Apr 21 04:25:19 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3375
revision-id:pqm at pqm.ubuntu.com-20080421032507-zw44l9w8k1riva6y
parent: pqm at pqm.ubuntu.com-20080419002305-25ayhxp3m0b95e9c
parent: mbp at sourcefrog.net-20080421010717-iji0e7xjwd1i6x2p
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-04-21 04:25:07 +0100
message:
(mbp) Set SO_REUSEADDR on server sockets (#164288)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/smart/server.py server.py-20061110062051-chzu10y32vx8gvur-1
------------------------------------------------------------
revno: 3374.1.1
revision-id:mbp at sourcefrog.net-20080421010717-iji0e7xjwd1i6x2p
parent: pqm at pqm.ubuntu.com-20080419002305-25ayhxp3m0b95e9c
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 164288-reuseaddr
timestamp: Mon 2008-04-21 11:07:17 +1000
message:
Set SO_REUSEADDR on server sockets (#164288)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/smart/server.py server.py-20061110062051-chzu10y32vx8gvur-1
=== modified file 'NEWS'
--- a/NEWS 2008-04-17 15:53:59 +0000
+++ b/NEWS 2008-04-21 01:07:17 +0000
@@ -26,6 +26,10 @@
* Avoid muttering every time a child update does not cause a progress bar
update. (John Arbash Meinel, #213771)
+ * Set SO_REUSEADDR on server sockets of ``bzr serve`` to avoid problems
+ rebinding the socket when starting the server a second time.
+ (John Arbash Meinel, Martin Pool, #164288)
+
* Severe performance degradation in fetching from knit repositories to
knits and packs due to parsing the entire revisions.kndx on every graph
walk iteration fixed by using the Repository.get_graph API. There was
=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py 2007-12-13 22:22:58 +0000
+++ b/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)
self._server_socket.bind((host, port))
self._sockname = self._server_socket.getsockname()
self.port = self._sockname[1]
More information about the bazaar-commits
mailing list