lib/packet/packet_nbio.rb in packet-0.1.13 vs lib/packet/packet_nbio.rb in packet-0.1.14
- old
+ new
@@ -11,18 +11,11 @@
end
def read_data(t_sock)
sock_data = []
begin
- if RUBY_PLATFORM =~ /linux/i
- while(t_data = t_sock.read_nonblock((16*1024)-1))
- sock_data << t_data
- end
- else
- while(t_data = t_sock.recv_nonblock((16*1024)-1))
- raise DisconnectError.new(t_sock,sock_data.join) if t_data.empty?
- sock_data << t_data
- end
+ while(t_data = t_sock.read_nonblock((16*1024)-1))
+ sock_data << t_data
end
rescue Errno::EAGAIN
return sock_data.join
rescue Errno::EWOULDBLOCK
return sock_data.join