
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.
22 lines
488 B
Ruby
Executable File
22 lines
488 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)
|
|
|
|
|
|
exit( 0 )
|