lib/em-synchrony/tcpsocket.rb in em-synchrony-1.0.0 vs lib/em-synchrony/tcpsocket.rb in em-synchrony-1.0.1

- old
+ new

@@ -3,13 +3,13 @@ class TCPSocket < Connection class << self alias_method :_old_new, :new def new(*args) if args.size == 1 - _old_new *args + _old_new(*args) else - socket = EventMachine::connect( *args[0..1], self ) + socket = EventMachine::connect(*args[0..1], self) raise SocketError unless socket.sync(:in) # wait for connection socket end end alias :open :new @@ -32,11 +32,11 @@ # TCPSocket interface def setsockopt(level, name, value); end def send(msg, flags = 0) - raise "Unknown flags in send(): #{flags}" if flags.nonzero? + raise "Unknown flags in send(): #{flags}" if flags.nonzero? len = msg.bytesize write_data(msg) or sync(:out) or raise(IOError) len end alias_method :write, :send @@ -58,10 +58,11 @@ end def unbind @in_req.fail nil if @in_req @out_req.fail nil if @out_req + close end def receive_data(data) @in_buff << data if @in_req && (data = read_data) @@ -105,6 +106,6 @@ end end end end end -end \ No newline at end of file +end