Skip to content

Commit

Permalink
close code have to be a UInt16
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed May 10, 2024
1 parent bdd7f52 commit 9ecdca1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/amqproxy/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module AMQProxy
# Channel::Close is sent, waiting for CloseOk
end
rescue ex : Upstream::WriteError
close_channel(src_channel)
close_channel(src_channel, 500_u16, "UPSTREAM_ERROR")
rescue KeyError
close_connection(504_u16, "CHANNEL_ERROR - Channel #{frame.channel} not open", frame)
end
Expand Down Expand Up @@ -126,7 +126,7 @@ module AMQProxy
@channel_map[id] = nil
end

private def close_all_upstream_channels(code = 500, reason = "CLIENT_DISCONNECTED")
private def close_all_upstream_channels(code = 500_u16, reason = "CLIENT_DISCONNECTED")
@channel_map.each_value do |upstream_channel|
upstream_channel.try &.close(code, reason)
rescue Upstream::WriteError
Expand Down
2 changes: 1 addition & 1 deletion src/amqproxy/upstream.cr
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module AMQProxy
@socket.closed?
end

private def close_all_client_channels(code = 500, reason = "UPSTREAM_ERROR")
private def close_all_client_channels(code = 500_u16, reason = "UPSTREAM_ERROR")
@channels_lock.synchronize do
return if @channels.empty?
Log.debug { "Upstream connection closed, closing #{@channels.size} client channels" }
Expand Down

0 comments on commit 9ecdca1

Please sign in to comment.