Make an EADDRINUSE on server bind fatal.

This is important because if we try to rebind after a migration and
someone else is in the way, any clients trying to reconnect to us will
instead be connecting to the squatter.
This commit is contained in:
Alex Young
2012-07-16 12:34:39 +01:00
parent 2e20e7197a
commit 1caa3d4e27
4 changed files with 18 additions and 12 deletions

View File

@@ -17,13 +17,5 @@ client.send_mirror()
sleep(1)
squatter.close()
sleep(1)
client2 = FakeSource.new( newaddr, newport.to_i, "Timed out reconnecting" )
client2.read_hello
client2.read( 0, 8 )
client2.close
exit( 0 )

View File

@@ -317,8 +317,13 @@ class FlexNBD
_, status = Process.waitpid2( pid )
if @kill
fail "flexnbd quit with a bad status: #{status.exitstatus}" unless
@kill.include? status.exitstatus
if status.signaled?
fail "flexnbd quit with a bad signal: #{status.inspect}" unless
@kill.include? status.termsig
else
fail "flexnbd quit with a bad status: #{status.inspect}" unless
@kill.include? status.exitstatus
end
else
$stderr.puts "flexnbd #{self.pid} quit"
fail "flexnbd #{self.pid} quit early with status #{status.to_i}"

View File

@@ -80,7 +80,8 @@ class TestDestErrorHandling < Test::Unit::TestCase
end
def test_cant_rebind_retries
def test_cant_rebind_dies
@env.nbd1.can_die(6)
run_fake( "source/successful_transfer" )
end