Skip to content

Commit

Permalink
No read timeout when waiting for next frame
Browse files Browse the repository at this point in the history
Bug ruby-amqp#519 wasn't quite resolved. If heartbeats are disabled (keepalive
used instead), Bunny would use the default read_timeout when waiting for
next frame, that meant that the connection would be closed with an
exception if there was no activity for 30s.
  • Loading branch information
carlhoerberg committed Apr 26, 2018
1 parent 72b9433 commit a7f93b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/bunny/transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def flush
@socket.flush if @socket
end

def read_fully(count)
def read_fully(count, timeout = @read_timeout)
begin
@socket.read_fully(count, @read_timeout)
@socket.read_fully(count, timeout)
rescue SystemCallError, Timeout::Error, Bunny::ConnectionError, IOError => e
@logger.error "Got an exception when receiving data: #{e.message} (#{e.class.name})"
close
Expand All @@ -233,7 +233,7 @@ def read_ready?(timeout = nil)
# Exposed primarily for Bunny::Channel
# @private
def read_next_frame(opts = {})
header = read_fully(7)
header = read_fully(7, nil)
type, channel, size = AMQ::Protocol::Frame.decode_header(header)
payload = if size > 0
read_fully(size)
Expand Down

0 comments on commit a7f93b4

Please sign in to comment.