summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hörberg <carl.hoerberg@gmail.com>2015-07-13 10:42:01 +0200
committerCarl Hörberg <carl.hoerberg@gmail.com>2015-07-15 12:11:44 +0200
commit393e2dfd57cedaacf5fb7b533c019143d8d2eba4 (patch)
treef15e425192a283433b349383ae584d98eb91d818
parentceca34823beb017e9615e77bd03fb3f54d64f50b (diff)
downloadrabbitmq-c-393e2dfd57cedaacf5fb7b533c019143d8d2eba4.tar.gz
If channel_max is 0, use server's channel_max
-rw-r--r--librabbitmq/amqp.h8
-rw-r--r--librabbitmq/amqp_socket.c3
2 files changed, 8 insertions, 3 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index f82273c..bfa7d26 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -1749,7 +1749,9 @@ AMQP_CALL amqp_get_rpc_reply(amqp_connection_state_t state);
* \param [in] channel_max the limit for number of channels for the connection.
* 0 means no limit, and is a good default (AMQP_DEFAULT_MAX_CHANNELS)
* Note that the maximum number of channels the protocol supports
- * is 65535 (2^16, with the 0-channel reserved)
+ * is 65535 (2^16, with the 0-channel reserved). The server can
+ * set a lower channel_max and then the client will use the lowest
+ * of the two
* \param [in] frame_max the maximum size of an AMQP frame on the wire to
* request of the broker for this connection. 4096 is the minimum
* size, 2^31-1 is the maximum, a good default is 131072 (128KB), or
@@ -1806,7 +1808,9 @@ AMQP_CALL amqp_login(amqp_connection_state_t state, char const *vhost,
* \param [in] channel_max the limit for the number of channels for the connection.
* 0 means no limit, and is a good default (AMQP_DEFAULT_MAX_CHANNELS)
* Note that the maximum number of channels the protocol supports
- * is 65535 (2^16, with the 0-channel reserved)
+ * is 65535 (2^16, with the 0-channel reserved). The server can
+ * set a lower channel_max and then the client will use the lowest
+ * of the two
* \param [in] frame_max the maximum size of an AMQP frame ont he wire to
* request of the broker for this connection. 4096 is the minimum
* size, 2^31-1 is the maximum, a good default is 131072 (128KB), or
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index c110765..b60573f 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -1354,7 +1354,8 @@ static amqp_rpc_reply_t amqp_login_inner(amqp_connection_state_t state,
server_heartbeat = s->heartbeat;
}
- if (server_channel_max != 0 && server_channel_max < channel_max) {
+ if (server_channel_max != 0 &&
+ (server_channel_max < channel_max || channel_max == 0)) {
channel_max = server_channel_max;
} else if (server_channel_max == 0 && channel_max == 0) {
channel_max = UINT16_MAX;