Azure IoT common library

Dependents:   STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more

Revision:
19:2e0811512ceb
Parent:
13:920e00014ee3
Child:
21:b92006c5b9ff
diff -r 6d8a413a4d9a -r 2e0811512ceb socketio_mbed.c
--- a/socketio_mbed.c	Fri Jan 13 18:41:15 2017 -0800
+++ b/socketio_mbed.c	Sat Jan 28 09:35:22 2017 -0800
@@ -2,10 +2,6 @@
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 #include <stdlib.h>
-#ifdef _CRTDBG_MAP_ALLOC
-#include <crtdbg.h>
-#endif
-
 #include <stddef.h>
 #include <stdio.h>
 #include <string.h>
@@ -249,15 +245,15 @@
 
                 socket_io_instance->io_state = IO_STATE_OPEN;
 
-                if (on_io_open_complete != NULL)
-                {
-                    on_io_open_complete(on_io_open_complete_context, IO_OPEN_OK);
-                }
-
                 result = 0;
             }
         }
     }
+    
+    if (on_io_open_complete != NULL)
+    {
+        on_io_open_complete(on_io_open_complete_context, result == 0 ? IO_OPEN_OK : IO_OPEN_ERROR);
+    }
 
     return result;
 }