
When we receive a migration, if rebinding to the new listen address and port fails for a reason which might be fixable, rather than killing the server we retry once a second. Also in this patch: non-overlapping log messages and a fix for the client going away halfway through a sendfile loop.
30 lines
646 B
Ruby
Executable File
30 lines
646 B
Ruby
Executable File
#!/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.
|
|
|
|
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()
|
|
|
|
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 )
|