diff options
author | Alan Antonuk <alan.antonuk@gmail.com> | 2013-06-14 14:20:26 -0700 |
---|---|---|
committer | Alan Antonuk <alan.antonuk@gmail.com> | 2013-06-14 14:20:26 -0700 |
commit | c83e7288ce82965a1cd1dc6d80db0486476d5f06 (patch) | |
tree | 798f610743c3775046bf48f08c1a1f2da942922e | |
parent | 33c2353efeac5e4803ed1940bf20e36b62fe500d (diff) | |
download | rabbitmq-c-github-ask-c83e7288ce82965a1cd1dc6d80db0486476d5f06.tar.gz |
Fix latent bugs with return error-codes
-rw-r--r-- | librabbitmq/amqp_socket.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c index cbca0bc..5fd0aa9 100644 --- a/librabbitmq/amqp_socket.c +++ b/librabbitmq/amqp_socket.c @@ -377,12 +377,8 @@ static int wait_frame_inner(amqp_connection_state_t state, res = amqp_socket_recv(state->socket, state->sock_inbound_buffer.bytes, state->sock_inbound_buffer.len, 0); - if (res <= 0) { - if (res == 0) { - return AMQP_STATUS_CONNECTION_CLOSED; - } else { - return amqp_socket_error(state->socket); - } + if (res < 0) { + return res; } state->sock_inbound_limit = res; @@ -413,7 +409,7 @@ int amqp_simple_wait_method(amqp_connection_state_t state, { amqp_frame_t frame; int res = amqp_simple_wait_frame(state, &frame); - if (res < 0) { + if (AMQP_STATUS_OK != res) { return res; } @@ -774,7 +770,7 @@ error_res: result.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION; result.reply.id = 0; result.reply.decoded = NULL; - result.library_error = -res; + result.library_error = res; goto out; } |