diff options
-rw-r--r-- | librabbitmq/amqp.h | 18 | ||||
-rw-r--r-- | librabbitmq/amqp_api.c | 10 | ||||
-rw-r--r-- | librabbitmq/amqp_socket.c | 12 |
3 files changed, 27 insertions, 13 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h index 71d77de..b25d84c 100644 --- a/librabbitmq/amqp.h +++ b/librabbitmq/amqp.h @@ -299,12 +299,20 @@ extern struct amqp_queue_purge_ok_t_ *amqp_queue_purge(amqp_connection_state_t s amqp_bytes_t queue, amqp_boolean_t no_wait); -// Can be used to see if there is data still in the buffer, if so -// calling amqp_simple_wait_frame will not enter the blocking read -// possibly amqp_frames_enqueued should be used for this? +/* + * Can be used to see if there is data still in the buffer, if so + * calling amqp_simple_wait_frame will not immediately enter a + * blocking read. + * + * Possibly amqp_frames_enqueued should be used for this? + */ extern amqp_boolean_t amqp_data_in_buffer(amqp_connection_state_t state); -// Expose amqp_rpc_reply to libraries -extern amqp_rpc_reply_t amqp_get_rpc_reply(); + +/* + * Expose amqp_rpc_reply to libraries. + */ +extern amqp_rpc_reply_t amqp_get_rpc_reply(void); + #ifdef __cplusplus } #endif diff --git a/librabbitmq/amqp_api.c b/librabbitmq/amqp_api.c index 2b887c7..4bd035d 100644 --- a/librabbitmq/amqp_api.c +++ b/librabbitmq/amqp_api.c @@ -213,7 +213,9 @@ amqp_rpc_reply_t amqp_basic_get(amqp_connection_state_t state, amqp_bytes_t queue, amqp_boolean_t no_ack) { - amqp_method_number_t replies[] = { AMQP_EXPAND_METHOD(BASIC, GET_OK), AMQP_EXPAND_METHOD(BASIC, GET_EMPTY), 0}; + amqp_method_number_t replies[] = { AMQP_BASIC_GET_OK_METHOD, + AMQP_BASIC_GET_EMPTY_METHOD, + 0 }; amqp_rpc_reply = AMQP_MULTIPLE_RESPONSE_RPC(state, channel, BASIC, GET, replies, amqp_basic_get_t, @@ -221,8 +223,10 @@ amqp_rpc_reply_t amqp_basic_get(amqp_connection_state_t state, return amqp_rpc_reply; } -// Expose amqp_rpc_reply to dynamically linked libraries -amqp_rpc_reply_t amqp_get_rpc_reply() +/* + * Expose amqp_rpc_reply to dynamically linked libraries + */ +amqp_rpc_reply_t amqp_get_rpc_reply(void) { return amqp_rpc_reply; } diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c index b4b9332..0149e7c 100644 --- a/librabbitmq/amqp_socket.c +++ b/librabbitmq/amqp_socket.c @@ -74,7 +74,7 @@ static amqp_bytes_t sasl_method_name(amqp_sasl_method_enum method) { default: amqp_assert(0, "Invalid SASL method: %d", (int) method); } - abort(); // unreachable + abort(); /* unreachable */ } static amqp_bytes_t sasl_response(amqp_pool_t *pool, @@ -107,8 +107,10 @@ amqp_boolean_t amqp_frames_enqueued(amqp_connection_state_t state) { return (state->first_queued_frame != NULL); } -// Check to see if we have data in our buffer so we will avoid -// if this returns 1, we will avoid a blocking read in amqp_simple_wait_frame +/* + * Check to see if we have data in our buffer. If this returns 1, we + * will avoid an immediate blocking read in amqp_simple_wait_frame. + */ amqp_boolean_t amqp_data_in_buffer(amqp_connection_state_t state) { return (state->sock_inbound_offset < state->sock_inbound_limit); } @@ -119,7 +121,7 @@ static int wait_frame_inner(amqp_connection_state_t state, while (1) { int result; - while (state->sock_inbound_offset < state->sock_inbound_limit) { + while (amqp_data_in_buffer(state)) { amqp_bytes_t buffer; buffer.len = state->sock_inbound_limit - state->sock_inbound_offset; buffer.bytes = ((char *) state->sock_inbound_buffer.bytes) + state->sock_inbound_offset; @@ -389,7 +391,7 @@ amqp_rpc_reply_t amqp_login(amqp_connection_state_t state, .capabilities = {.len = 0, .bytes = NULL}, .insist = 1 }; - amqp_method_number_t replies[] = { AMQP_EXPAND_METHOD( CONNECTION, OPEN_OK ), 0 }; + amqp_method_number_t replies[] = { AMQP_CONNECTION_OPEN_OK_METHOD, 0 }; result = amqp_simple_rpc(state, 0, AMQP_CONNECTION_OPEN_METHOD, |