2012-06-22 10:05:41 +01:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
# Wait for a sender connection, send a correct hello, then disconnect.
|
|
|
|
# Simulate a server which crashes after sending the hello. We then
|
|
|
|
# reopen the server socket to check that the sender retries: since the
|
|
|
|
# command-line has gone away, and can't feed an error back to the
|
|
|
|
# user, we have to keep trying.
|
|
|
|
|
2012-06-28 11:34:36 +01:00
|
|
|
require 'flexnbd/fake_dest'
|
2012-07-02 15:04:45 +01:00
|
|
|
include FlexNBD
|
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
|
|
|
client = server.accept( "Timed out waiting for a connection" )
|
|
|
|
client.write_hello
|
|
|
|
client.close
|
2012-06-22 10:05:41 +01:00
|
|
|
|
2012-07-02 15:04:45 +01:00
|
|
|
new_client = server.accept( "Timed out waiting for a reconnection" )
|
|
|
|
new_client.close
|
2012-06-22 10:05:41 +01:00
|
|
|
|
2012-07-02 15:04:45 +01:00
|
|
|
server.close
|
2012-06-22 10:05:41 +01:00
|
|
|
|
|
|
|
exit 0
|