Remove listen mode

Changing behaviour so that instead of rebinding after a successful
migration and continuing as an ordinary server, we simply quit with a
0 exit code and let our caller restart us as a server if they want to.
This means that everything in listen.c, listen.h, and anything making
reference to a rebind address is unneeded.
This commit is contained in:
Alex Young
2012-07-23 09:48:50 +01:00
parent 77f4ac29c6
commit 4790912750
19 changed files with 122 additions and 551 deletions

View File

@@ -3,8 +3,8 @@
# Connect, send a migration, entrust then *immediately* disconnect.
# This simulates a client which fails while the client is blocked.
#
# We attempt to reconnect immediately afterwards to prove that we can
# retry the mirroring.
# In this situation we expect the destination to quit with an error
# status.
require 'flexnbd/fake_source'
include FlexNBD
@@ -28,7 +28,11 @@ system "kill -CONT #{srv_pid}"
sleep(0.25)
client2 = FakeSource.new( addr, port, "Timed out reconnecting" )
client2.close
begin
client2 = FakeSource.new( addr, port, "Expected timeout" )
fail "Unexpected reconnection"
rescue Timeout::Error
# expected
end
exit(0)

View File

@@ -1,10 +1,9 @@
#!/usr/bin/env ruby
# Connect, send a migration, entrust then *immediately* disconnect.
# Connect, send a migration, entrust, read the reply, then disconnect.
# This simulates a client which fails while the client is blocked.
#
# We attempt to reconnect immediately afterwards to prove that we can
# retry the mirroring.
# We expect the destination to quit with an error status.
require 'flexnbd/fake_source'
include FlexNBD
@@ -22,11 +21,12 @@ client.close
sleep(0.25)
client2 = FakeSource.new( addr, port, "Timed out reconnecting to mirror" )
client2.send_mirror
sleep(1)
client3 = FakeSource.new( rebind_addr, rebind_port, "Timed out reconnecting to read" )
client3.close
begin
client2 = FakeSource.new( addr, port, "Expected timeout" )
fail "Unexpected reconnection"
rescue Timeout::Error
# expected
end
exit(0)

View File

@@ -12,10 +12,11 @@ addr, port, srv_pid = *ARGV
client = FakeSource.new( addr, port, "Timed out connecting" )
client.read_hello
Process.kill( "STOP", srv_pid.to_i )
system "kill -STOP #{srv_pid}"
client.write_write_request( 0, 8 )
client.close
Process.kill( "CONT", srv_pid.to_i )
system "kill -CONT #{srv_pid}"
# This sleep ensures that we don't return control to the test runner
# too soon, giving the flexnbd process time to fall over if it's going

View File

@@ -13,13 +13,13 @@ addr, port, srv_pid = *ARGV
client = FakeSource.new( addr, port, "Timed out connecting" )
client.read_hello
Process.kill( "STOP", srv_pid.to_i )
system "kill -STOP #{srv_pid}"
client.write_write_request( 0, 8 )
client.write_data( "12345678" )
client.close
Process.kill( "CONT", srv_pid.to_i )
system "kill -CONT #{srv_pid}"
# This sleep ensures that we don't return control to the test runner
# too soon, giving the flexnbd process time to fall over if it's going

View File

@@ -1,17 +1,14 @@
#!/usr/bin/env ruby
# Successfully send a migration, but squat on the IP and port which
# the destination wants to rebind to. The destination should retry
# every second, so we give it up then attempt to connect to the new
# server.
# Successfully send a migration. This test just makes sure that the
# happy path is covered. We expect the destination to quit with a
# success status.
require 'flexnbd/fake_source'
include FlexNBD
addr, port, srv_pid, newaddr, newport = *ARGV
squatter = TCPServer.open( newaddr, newport.to_i )
client = FakeSource.new( addr, port, "Timed out connecting" )
client.send_mirror()