A small memory footprint AMQP implimentation

Dependents:   iothub_client_sample_amqp remote_monitoring simplesample_amqp

Revision:
36:8e1d94b0a70c
Parent:
35:d0bed2404ee9
Child:
40:f0ceafa8d570
--- a/message_sender.c	Fri Nov 03 13:18:57 2017 -0700
+++ b/message_sender.c	Fri Nov 17 13:58:00 2017 -0800
@@ -513,24 +513,28 @@
 
                 if (result == SEND_ONE_MESSAGE_OK)
                 {
+                    ASYNC_OPERATION_HANDLE transfer_async_operation;
+                    LINK_TRANSFER_RESULT link_transfer_error;
                     MESSAGE_WITH_CALLBACK* message_with_callback = GET_ASYNC_OPERATION_CONTEXT(MESSAGE_WITH_CALLBACK, pending_send);
                     message_with_callback->message_send_state = MESSAGE_SEND_STATE_PENDING;
-                    switch (link_transfer_async(message_sender->link, message_format, &payload, 1, on_delivery_settled, pending_send, message_with_callback->timeout))
+                    
+                    transfer_async_operation = link_transfer_async(message_sender->link, message_format, &payload, 1, on_delivery_settled, pending_send, &link_transfer_error, message_with_callback->timeout);
+                    if (transfer_async_operation == NULL)
                     {
-                    default:
-                    case LINK_TRANSFER_ERROR:
-                        LogError("Error in link transfer");
-                        result = SEND_ONE_MESSAGE_ERROR;
-                        break;
-
-                    case LINK_TRANSFER_BUSY:
-                        message_with_callback->message_send_state = MESSAGE_SEND_STATE_NOT_SENT;
-                        result = SEND_ONE_MESSAGE_BUSY;
-                        break;
-
-                    case LINK_TRANSFER_OK:
+                        if (link_transfer_error == LINK_TRANSFER_BUSY)
+                        {
+                            message_with_callback->message_send_state = MESSAGE_SEND_STATE_NOT_SENT;
+                            result = SEND_ONE_MESSAGE_BUSY;
+                        }
+                        else
+                        {
+                            LogError("Error in link transfer");
+                            result = SEND_ONE_MESSAGE_ERROR;
+                        }
+                    }
+                    else
+                    {
                         result = SEND_ONE_MESSAGE_OK;
-                        break;
                     }
                 }