diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-09-16 23:04:37 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-09-17 11:55:53 -0700 |
commit | 9435ee2d5111394739b82d0f8a275deca8d505be (patch) | |
tree | c1249fd0fd9ea51aa8e7284d6c434acc94d4a8b6 /test/test_helper.rb | |
parent | 04c7fc37ab4fb2fbaa1b4a2570871713cf9d1319 (diff) | |
download | unicorn-9435ee2d5111394739b82d0f8a275deca8d505be.tar.gz |
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 <normalperson@yhbt.net>
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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) |