Skip to content

Commit 2a0aa51

Browse files
committed
Actually, the channel number is unsigned
1 parent 25ddd01 commit 2a0aa51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/com/rabbitmq/client/impl/ChannelManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public synchronized ChannelN createChannel(AMQConnection connection, int channel
9898

9999
public synchronized int allocateChannelNumber(int maxChannels) {
100100
if (maxChannels == 0) {
101-
// The framing encoding only allows for 16-bit integers for the channel number
102-
maxChannels = Short.MAX_VALUE;
101+
// The framing encoding only allows for unsigned 16-bit integers for the channel number
102+
maxChannels = (1 << 16) - 1;
103103
}
104104
int channelNumber = -1;
105105
for (int candidate = 1; candidate <= maxChannels; candidate++) {

0 commit comments

Comments
 (0)