lib/bertrpc/action.rb in bertrpc-1.2.1 vs lib/bertrpc/action.rb in bertrpc-1.3.0

- old
+ new

@@ -27,10 +27,11 @@ data, size = [], 0 while size < len r, w, e = IO.select([sock], [], [], timeout) raise Errno::EAGAIN if r.nil? msg, sender = sock.recvfrom(len - size) + raise Errno::ECONNRESET if msg.size == 0 size += msg.size data << msg end data.join '' end @@ -54,12 +55,14 @@ bert_response = read(sock, len, timeout) raise ProtocolError.new(ProtocolError::NO_DATA) unless bert_response sock.close bert_response rescue Errno::ECONNREFUSED - raise ConnectionError.new("Unable to connect to #{@svc.host}:#{@svc.port}") + raise ConnectionError.new(@svc.host, @svc.port) rescue Errno::EAGAIN raise ReadTimeoutError.new(@svc.host, @svc.port, @svc.timeout) + rescue Errno::ECONNRESET + raise ReadError.new(@svc.host, @svc.port) end # Creates a socket object which does speedy, non-blocking reads # and can perform reliable read timeouts. #