Make test sockets less dependent on enviroment

It seems that ruby in a default wheezy VM can't handle a source address
of nil.
This commit is contained in:
Alex Young
2012-07-14 10:04:55 +01:00
parent 2ea5a2e38a
commit e4d2b9a667

View File

@@ -9,7 +9,11 @@ module FlexNBD
def initialize( addr, port, err_msg, source_addr=nil, source_port=0 )
timing_out( 2, err_msg ) do
@sock = TCPSocket.new( addr, port, source_addr, source_port )
@sock = if source_addr
TCPSocket.new( addr, port, source_addr, source_port )
else
TCPSocket.new( addr, port )
end
end
end