A small memory footprint AMQP implimentation

Dependents:   iothub_client_sample_amqp remote_monitoring simplesample_amqp

Revision:
44:9dd558f13109
Parent:
43:4c1e4e94cdd3
--- a/session.c	Mon Jun 11 15:39:52 2018 -0700
+++ b/session.c	Tue Jun 26 19:14:57 2018 -0700
@@ -447,17 +447,20 @@
             {
                 end_session_with_error(session_instance, "amqp:decode-error", "Cannot get link role from ATTACH frame");
             }
-            else if (attach_get_source(attach_handle, &source) != 0)
-            {
-                end_session_with_error(session_instance, "amqp:decode-error", "Cannot get link source from ATTACH frame");
-            }
-            else if (attach_get_target(attach_handle, &target) != 0)
-            {
-                end_session_with_error(session_instance, "amqp:decode-error", "Cannot get link target from ATTACH frame");
-            }
             else
             {
-                LINK_ENDPOINT_INSTANCE* link_endpoint = find_link_endpoint_by_name(session_instance, name);
+                LINK_ENDPOINT_INSTANCE* link_endpoint;
+
+                if (attach_get_source(attach_handle, &source) != 0)
+                {
+                    source = NULL;
+                }
+                if (attach_get_target(attach_handle, &target) != 0)
+                {
+                    target = NULL;
+                }
+
+                link_endpoint = find_link_endpoint_by_name(session_instance, name);
                 if (link_endpoint == NULL)
                 {
                     /* new link attach */
@@ -541,6 +544,7 @@
                 {
                     if (link_endpoint->link_endpoint_state != LINK_ENDPOINT_STATE_DETACHING)
                     {
+                        link_endpoint->link_endpoint_state = LINK_ENDPOINT_STATE_DETACHING;
                         link_endpoint->frame_received_callback(link_endpoint->callback_context, performative, payload_size, payload_bytes);
                     }
                     else