Check that a mirror write returning an error will cause a reconnect and retry

This commit is contained in:
Alex Young
2012-07-02 15:04:45 +01:00
parent 99f8c24b01
commit ea4642a878
10 changed files with 192 additions and 88 deletions

View File

@@ -6,22 +6,23 @@
# write has gone MIA, and we expect a reconnect.
require 'flexnbd/fake_dest'
include FlexNBD::FakeDest
include FlexNBD
sock = serve( *ARGV )
client_sock1 = accept( sock )
write_hello( client_sock1 )
read_request( client_sock1 )
server = FakeDest.new( *ARGV )
client1 = server.accept( server )
client1.write_hello
client1.read_request
t = Thread.start do
client_sock2 = accept( sock, "Timed out waiting for a reconnection",
client2 = server.accept( "Timed out waiting for a reconnection",
FlexNBD::MS_REQUEST_LIMIT_SECS + 2 )
client_sock2.close
client2.close
end
sleep( FlexNBD::MS_REQUEST_LIMIT_SECS + 2 )
client_sock1.close
client1.close
t.join
server.close
exit(0)