lib/cosmos/streams/tcpip_socket_stream.rb in cosmos-3.2.1 vs lib/cosmos/streams/tcpip_socket_stream.rb in cosmos-3.3.0
- old
+ new
@@ -37,10 +37,11 @@
@read_timeout = @read_timeout.to_f if @read_timeout
# Mutex on write is needed to protect from commands coming in from more
# than one tool
@write_mutex = Mutex.new
+ @connected = false
end
# @return [String] Returns a binary string of data from the socket
def read
raise "Attempt to read from write only stream" unless @read_socket
@@ -48,10 +49,10 @@
# No read mutex is needed because there is only one stream procesor
# reading
begin
data = @read_socket.recv_nonblock(65535)
@raw_logger_pair.read_logger.write(data) if @raw_logger_pair
- rescue Errno::EAGAIN, Errno::EWOULDBLOCK
+ rescue IO::WaitReadable
# Wait for the socket to be ready for reading or for the timeout
begin
result = IO.fast_select([@read_socket], nil, nil, @read_timeout)
# If select returns something it means the socket is now available for