Microsoft Azure IoTHub client libraries

Dependents:   sht15_remote_monitoring RobotArmDemo iothub_client_sample_amqp f767zi_mqtt ... more

This library implements the Microsoft Azure IoTHub client library. The code is replicated from https://github.com/Azure/azure-iot-sdks

Revision:
73:c4d9077dd0a1
Parent:
70:875388a7d419
Child:
75:86205ca63a59
--- a/iothub_client_ll.c	Fri Jul 28 09:52:16 2017 -0700
+++ b/iothub_client_ll.c	Fri Aug 11 14:02:31 2017 -0700
@@ -325,6 +325,11 @@
                 if (create_blob_upload_module(result, config) != 0)
                 {
                     LogError("unable to create blob upload");
+                    // Codes_SRS_IOTHUBCLIENT_LL_09_010: [ If any failure occurs `IoTHubClient_LL_Create` shall destroy the `transportHandle` only if it has created it ]
+                    if (!result->isSharedTransport)
+                    {
+                        result->IoTHubTransport_Destroy(result->transportHandle);
+                    }
                     IoTHubClient_Auth_Destroy(result->authorization_module);
                     STRING_delete(product_info);
                     free(result);
@@ -335,6 +340,11 @@
                     if ((result->tickCounter = tickcounter_create()) == NULL)
                     {
                         LogError("unable to get a tickcounter");
+                        // Codes_SRS_IOTHUBCLIENT_LL_09_010: [ If any failure occurs `IoTHubClient_LL_Create` shall destroy the `transportHandle` only if it has created it ]
+                        if (!result->isSharedTransport)
+                        {
+                            result->IoTHubTransport_Destroy(result->transportHandle);
+                        }
                         destroy_blob_upload_module(result);
                         IoTHubClient_Auth_Destroy(result->authorization_module);
                         STRING_delete(product_info);
@@ -363,7 +373,11 @@
                         {
                             LogError("Registering device in transport failed");
                             IoTHubClient_Auth_Destroy(result->authorization_module);
-                            result->IoTHubTransport_Destroy(result->transportHandle);
+                            // Codes_SRS_IOTHUBCLIENT_LL_09_010: [ If any failure occurs `IoTHubClient_LL_Create` shall destroy the `transportHandle` only if it has created it ]
+                            if (!result->isSharedTransport)
+                            {
+                                result->IoTHubTransport_Destroy(result->transportHandle);
+                            }
                             destroy_blob_upload_module(result);
                             tickcounter_destroy(result->tickCounter);
                             STRING_delete(product_info);
@@ -381,7 +395,11 @@
                                 LogError("Setting default retry policy in transport failed");
                                 result->IoTHubTransport_Unregister(result->deviceHandle);
                                 IoTHubClient_Auth_Destroy(result->authorization_module);
-                                result->IoTHubTransport_Destroy(result->transportHandle);
+                                // Codes_SRS_IOTHUBCLIENT_LL_09_010: [ If any failure occurs `IoTHubClient_LL_Create` shall destroy the `transportHandle` only if it has created it ]
+                                if (!result->isSharedTransport)
+                                {
+                                    result->IoTHubTransport_Destroy(result->transportHandle);
+                                }
                                 destroy_blob_upload_module(result);
                                 tickcounter_destroy(result->tickCounter);
                                 STRING_delete(product_info);
@@ -443,6 +461,8 @@
             result->ms_timesOutAfter = 0;
             result->context = userContextCallback;
             result->reported_state_callback = reportedStateCallback;
+			result->client_handle = handleData;
+			result->device_handle = handleData->deviceHandle;
         }
     }
     else