A small memory footprint AMQP implimentation

Dependents:   iothub_client_sample_amqp remote_monitoring simplesample_amqp

Revision:
20:206846c14c80
Parent:
19:000ab4e6a2c1
Child:
21:f9c433d8e6ca
diff -r 000ab4e6a2c1 -r 206846c14c80 connection.c
--- a/connection.c	Fri Feb 24 14:00:58 2017 -0800
+++ b/connection.c	Fri Mar 10 11:47:49 2017 -0800
@@ -1034,8 +1034,24 @@
                                 result->on_connection_state_changed = on_connection_state_changed;
                                 result->on_connection_state_changed_callback_context = on_connection_state_changed_context;
 
-                                /* Codes_SRS_CONNECTION_01_072: [When connection_create succeeds, the state of the connection shall be CONNECTION_STATE_START.] */
-                                connection_set_state(result, CONNECTION_STATE_START);
+                                if (tickcounter_get_current_ms(result->tick_counter, &result->last_frame_received_time) != 0)
+                                {
+                                    LogError("Could not retrieve time for last frame received time");
+                                    tickcounter_destroy(result->tick_counter);
+                                    amqpalloc_free(result->container_id);
+                                    amqpalloc_free(result->host_name);
+                                    amqp_frame_codec_destroy(result->amqp_frame_codec);
+                                    frame_codec_destroy(result->frame_codec);
+                                    amqpalloc_free(result);
+                                    result = NULL;
+                                }
+                                else
+                                {
+                                    result->last_frame_sent_time = result->last_frame_received_time;
+
+                                    /* Codes_SRS_CONNECTION_01_072: [When connection_create succeeds, the state of the connection shall be CONNECTION_STATE_START.] */
+                                    connection_set_state(result, CONNECTION_STATE_START);
+                                }
                             }
                         }
                     }