A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
Diff: link.c
- Revision:
- 46:01f7ca900e07
- Parent:
- 44:9dd558f13109
--- a/link.c Thu Jul 12 18:09:41 2018 -0700 +++ b/link.c Tue Sep 11 11:13:43 2018 -0700 @@ -444,7 +444,7 @@ is_error = true; } } - + if (!is_error) { /* If this is a continuation transfer or if this is the first chunk of a multi frame transfer */ @@ -622,22 +622,24 @@ } } - if (detach_get_error(detach, &error) == 0) + if (detach_get_error(detach, &error) != 0) { - remove_all_pending_deliveries(link_instance, true); - set_link_state(link_instance, LINK_STATE_ERROR); + error = NULL; + } + remove_all_pending_deliveries(link_instance, true); + // signal link detach received in order to handle cases like redirect + if (link_instance->on_link_detach_received_event_subscription.on_link_detach_received != NULL) + { + link_instance->on_link_detach_received_event_subscription.on_link_detach_received(link_instance->on_link_detach_received_event_subscription.context, error); + } - // signal link detach received in order to handle cases like redirect - if (link_instance->on_link_detach_received_event_subscription.on_link_detach_received != NULL) - { - link_instance->on_link_detach_received_event_subscription.on_link_detach_received(link_instance->on_link_detach_received_event_subscription.context, error); - } - + if (error != NULL) + { + set_link_state(link_instance, LINK_STATE_ERROR); error_destroy(error); } - else + else { - remove_all_pending_deliveries(link_instance, true); set_link_state(link_instance, LINK_STATE_DETACHED); } @@ -1307,7 +1309,7 @@ { pending_delivery->on_delivery_settled(pending_delivery->callback_context, pending_delivery->delivery_id, LINK_DELIVERY_SETTLE_REASON_CANCELLED, NULL); } - + (void)singlylinkedlist_remove_if(((LINK_HANDLE)pending_delivery->link)->pending_deliveries, remove_pending_delivery_condition_function, pending_delivery); async_operation_destroy(link_transfer_operation);