A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
Diff: message_receiver.c
- Revision:
- 1:eab586236bfe
- Parent:
- 0:6ae2f7bca550
- Child:
- 6:641a9672db08
--- a/message_receiver.c Fri Apr 08 12:01:10 2016 -0700 +++ b/message_receiver.c Sun Apr 24 16:40:31 2016 -0700 @@ -159,10 +159,10 @@ { AMQP_VALUE result = NULL; - MESSAGE_RECEIVER_INSTANCE* message_receiver_instance = (MESSAGE_RECEIVER_INSTANCE*)context; - if (message_receiver_instance->on_message_received != NULL) - { - MESSAGE_HANDLE message = message_create(); + MESSAGE_RECEIVER_INSTANCE* message_receiver_instance = (MESSAGE_RECEIVER_INSTANCE*)context; + if (message_receiver_instance->on_message_received != NULL) + { + MESSAGE_HANDLE message = message_create(); if (message == NULL) { set_message_receiver_state(message_receiver_instance, MESSAGE_RECEIVER_STATE_ERROR); @@ -200,7 +200,7 @@ message_destroy(message); } - } + } return result; } @@ -230,6 +230,12 @@ set_message_receiver_state(message_receiver_instance, MESSAGE_RECEIVER_STATE_ERROR); } break; + case LINK_STATE_ERROR: + if (message_receiver_instance->message_receiver_state != MESSAGE_RECEIVER_STATE_ERROR) + { + set_message_receiver_state(message_receiver_instance, MESSAGE_RECEIVER_STATE_ERROR); + } + break; } } @@ -251,6 +257,7 @@ { if (message_receiver != NULL) { + (void)messagereceiver_close(message_receiver); amqpalloc_free(message_receiver); } }