From 9435ee2d5111394739b82d0f8a275deca8d505be Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Sep 2009 23:04:37 -0700 Subject: SIGHUP no longer drops lone, default listener When SIGHUP reloads the config, we didn't account for the case where the listen socket was completely unspecified. Thus the default listener (0.0.0.0:8080), did not get preserved and re-injected into the config properly. Note that relying on the default listen or specifying listeners on the command-line means it's /practically/ impossible to _unbind_ those listeners with a configuration file reload. We also need to preserve the (unspecified) default listener across upgrades that later result in SIGHUP, too; so the easiest way is to inject the default listener into the command-line for upgrades. Many thanks to James Golick for reporting and helping me track down the bug since this behavior is difficult to write reliable automated tests for. Signed-off-by: Eric Wong --- test/test_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/test_helper.rb') diff --git a/test/test_helper.rb b/test/test_helper.rb index d3bf46c..3a3e42f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -104,6 +104,12 @@ def unused_port(addr = '127.0.0.1') begin begin port = base + rand(32768 - base) + if addr == Unicorn::Const::DEFAULT_HOST + while port == Unicorn::Const::DEFAULT_PORT + port = base + rand(32768 - base) + end + end + sock = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) sock.bind(Socket.pack_sockaddr_in(port, addr)) sock.listen(5) -- cgit v1.2.3-24-ge0c7