Handle a failed disconnect correctly

If the sender disconnects its socket before sending the disconnect
message, the destination should restart the migration process.  This
patch makes sure that happens.
This commit is contained in:
Alex Young
2012-07-12 09:39:39 +01:00
parent f3cebcdcd5
commit eb90308b6e
9 changed files with 154 additions and 14 deletions

View File

@@ -94,7 +94,7 @@ module FlexNBD
end
def receive_mirror
def receive_mirror( opts = {} )
write_hello()
loop do
req = read_request
@@ -103,7 +103,7 @@ module FlexNBD
read_data( req[:len] )
write_reply( req[:handle] )
when 65536
write_reply( req[:handle] )
write_reply( req[:handle], opts[:err] == :entrust ? 1 : 0 )
break
else
raise "Unexpected request: #{req.inspect}"