Skip to content

Commit

Permalink
Treat all frames as heartbeats
Browse files Browse the repository at this point in the history
  • Loading branch information
spuun committed Nov 19, 2024
1 parent f59fa88 commit f55e711
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/amqproxy/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ module AMQProxy
i = 0u64
socket.read_timeout = (@heartbeat / 2).ceil.seconds if @heartbeat > 0
loop do
case frame = AMQ::Protocol::Frame.from_io(socket, IO::ByteFormat::NetworkEndian)
when AMQ::Protocol::Frame::Heartbeat
@last_heartbeat = Time.monotonic
frame = AMQ::Protocol::Frame.from_io(socket, IO::ByteFormat::NetworkEndian)
@last_heartbeat = Time.monotonic
case frame
when AMQ::Protocol::Frame::Heartbeat # noop
when AMQ::Protocol::Frame::Connection::CloseOk then return
when AMQ::Protocol::Frame::Connection::Close
close_all_upstream_channels(frame.reply_code, frame.reply_text)
Expand Down

0 comments on commit f55e711

Please sign in to comment.