[Buildbot-commits] buildbot/buildbot master.py,1.87,1.88
Brian Warner
warner at users.sourceforge.net
Fri Nov 25 01:25:13 UTC 2005
Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14285/buildbot
Modified Files:
master.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-434
Creator: Brian Warner <warner at lothar.com>
fix test_config.StartService, by not using a fixed slavePort
* buildbot/test/test_config.py (StartService): don't claim a fixed
port number, instead set slavePort=0 on the first pass, figure out
what port was allocated, then switch to a config file that uses
the allocated port.
* buildbot/master.py (BuildMaster.loadConfig): close the old
slaveport before opening the new one, because unit tests might
replace slavePort=0 with the same allocated portnumber, and if we
don't wait for the old port to close first, we get a "port already
in use" error. There is a tiny race condition here, but the only
threat is from other programs that bind (statically) to the same
port number we happened to be allocated, and only if those
programs use SO_REUSEADDR, and only if they get control in between
reactor turns.
Index: master.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/master.py,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- master.py 25 Nov 2005 00:36:41 -0000 1.87
+++ master.py 25 Nov 2005 01:25:11 -0000 1.88
@@ -849,9 +849,11 @@
d.addCallback(lambda res: self.slavePort.disownServiceParent())
self.slavePort = None
if slavePortnum is not None:
- self.slavePort = internet.TCPServer(slavePortnum,
- self.slaveFactory)
- self.slavePort.setServiceParent(self)
+ def openSlavePort(res):
+ self.slavePort = internet.TCPServer(slavePortnum,
+ self.slaveFactory)
+ self.slavePort.setServiceParent(self)
+ d.addCallback(openSlavePort)
log.msg("BuildMaster listening on port %d" % slavePortnum)
self.slavePortnum = slavePortnum
More information about the Commits
mailing list