2012-06-22 10:05:41 +01:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
# Simulate a destination which sends the wrong magic.
|
|
|
|
|
2012-06-28 11:34:36 +01:00
|
|
|
require 'flexnbd/fake_dest'
|
2012-07-02 15:04:45 +01:00
|
|
|
include FlexNBD
|
2012-07-15 22:07:00 +01:00
|
|
|
Thread.abort_on_exception
|
2012-06-22 10:05:41 +01:00
|
|
|
|
2012-07-03 15:25:39 +01:00
|
|
|
addr, port = *ARGV
|
|
|
|
server = FakeDest.new( addr, port )
|
2012-07-02 15:04:45 +01:00
|
|
|
client1 = server.accept
|
2012-06-22 10:05:41 +01:00
|
|
|
|
2012-07-15 22:07:00 +01:00
|
|
|
# We don't expect a reconnection attempt.
|
2012-06-22 10:05:41 +01:00
|
|
|
t = Thread.new do
|
2012-07-15 22:07:00 +01:00
|
|
|
begin
|
|
|
|
client2 = server.accept( "Timed out waiting for a reconnection",
|
|
|
|
FlexNBD::MS_RETRY_DELAY_SECS + 1 )
|
|
|
|
fail "Unexpected reconnection"
|
|
|
|
rescue Timeout::Error
|
|
|
|
#expected
|
|
|
|
end
|
2012-06-22 10:05:41 +01:00
|
|
|
end
|
|
|
|
|
2012-07-02 15:04:45 +01:00
|
|
|
client1.write_hello( :magic => :wrong )
|
2012-06-22 10:05:41 +01:00
|
|
|
|
|
|
|
t.join
|
|
|
|
|
|
|
|
exit 0
|