summaryrefslogtreecommitdiff
path: root/examples/amqp_listenq.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/amqp_listenq.c')
-rw-r--r--examples/amqp_listenq.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/amqp_listenq.c b/examples/amqp_listenq.c
index 0057826..98c389f 100644
--- a/examples/amqp_listenq.c
+++ b/examples/amqp_listenq.c
@@ -51,7 +51,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
#include <stdint.h>
#include <amqp.h>
@@ -107,7 +106,7 @@ int main(int argc, char const * const *argv) {
amqp_maybe_release_buffers(conn);
result = amqp_simple_wait_frame(conn, &frame);
printf("Result %d\n", result);
- if (result <= 0)
+ if (result < 0)
break;
printf("Frame type %d, channel %d\n", frame.frame_type, frame.channel);
@@ -125,7 +124,7 @@ int main(int argc, char const * const *argv) {
(int) d->routing_key.len, (char *) d->routing_key.bytes);
result = amqp_simple_wait_frame(conn, &frame);
- if (result <= 0)
+ if (result < 0)
break;
if (frame.frame_type != AMQP_FRAME_HEADER) {
@@ -144,7 +143,7 @@ int main(int argc, char const * const *argv) {
while (body_received < body_target) {
result = amqp_simple_wait_frame(conn, &frame);
- if (result <= 0)
+ if (result < 0)
break;
if (frame.frame_type != AMQP_FRAME_BODY) {
@@ -171,8 +170,7 @@ int main(int argc, char const * const *argv) {
die_on_amqp_error(amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS), "Closing channel");
die_on_amqp_error(amqp_connection_close(conn, AMQP_REPLY_SUCCESS), "Closing connection");
- amqp_destroy_connection(conn);
- die_on_error(close(sockfd), "Closing socket");
+ die_on_error(amqp_destroy_connection(conn), "Ending connection");
return 0;
}