Skip to content

Commit

Permalink
expect more frams in client for Deliver/Return/GetOk
Browse files Browse the repository at this point in the history
Not publish, the server never sends Publish frames to client
  • Loading branch information
carlhoerberg committed May 12, 2024
1 parent fb5fc51 commit 696e895
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 @@ -132,7 +132,7 @@ module AMQProxy
def write(frame : AMQ::Protocol::Frame)
@lock.synchronize do
@socket.write_bytes frame, IO::ByteFormat::NetworkEndian
@socket.flush unless expect_more_publish_frames?(frame)
@socket.flush unless expect_more_frames?(frame)
end
case frame
when AMQ::Protocol::Frame::Channel::Close
Expand Down Expand Up @@ -170,9 +170,10 @@ module AMQProxy
@channel_map.clear
end

private def expect_more_publish_frames?(frame) : Bool
private def expect_more_frames?(frame) : Bool
case frame
when AMQ::Protocol::Frame::Basic::Publish then true
when AMQ::Protocol::Frame::Basic::Deliver then true
when AMQ::Protocol::Frame::Basic::Return then true
when AMQ::Protocol::Frame::Basic::GetOk then true
when AMQ::Protocol::Frame::Header then frame.body_size != 0
when AMQ::Protocol::Frame::Body then frame.bytesize == @frame_max
Expand Down

0 comments on commit 696e895

Please sign in to comment.