Don't retry a mirror which failed on the first attempt
If the mirror attempt failed and we were able to report an error to the user, it makes no sense to attempt a retry. We don't have a way to abort a mirror attempt yet, so if the user got a setting wrong and it's failing for that reason, the only recourse they'd have would be to restart the server.
This commit is contained in:
@@ -6,15 +6,24 @@
|
||||
|
||||
require 'flexnbd/fake_dest'
|
||||
include FlexNBD
|
||||
Thread.abort_on_exception = true
|
||||
|
||||
addr, port = *ARGV
|
||||
server = FakeDest.new( addr, port )
|
||||
client = server.accept
|
||||
|
||||
t = Thread.new do
|
||||
client2 = server.accept( "Timed out waiting for a reconnection",
|
||||
FlexNBD::MS_RETRY_DELAY_SECS + 1 )
|
||||
client2.close
|
||||
# The sender *should not reconnect.* Since this is a first-pass
|
||||
# mirror attempt, the user will have been told that the mirror failed,
|
||||
# so it makes no sense to continue. This means we have to invert the
|
||||
# sense of the exception.
|
||||
begin
|
||||
client2 = server.accept( "Timed out waiting for a reconnection",
|
||||
FlexNBD::MS_RETRY_DELAY_SECS + 1 )
|
||||
client2.close
|
||||
fail "Unexpected reconnection."
|
||||
rescue Timeout::Error
|
||||
end
|
||||
end
|
||||
|
||||
client.write_hello( :size => :wrong )
|
||||
|
@@ -144,8 +144,7 @@ module FlexNBD
|
||||
client_sock = @sock.accept
|
||||
end
|
||||
rescue Timeout::Error
|
||||
$stderr.puts err_msg
|
||||
exit 1
|
||||
raise Timeout::Error.new(err_msg)
|
||||
end
|
||||
|
||||
client_sock
|
||||
|
Reference in New Issue
Block a user