Azure IoT common library

Fork of azure_c_shared_utility by Azure IoT

Revision:
19:2e0811512ceb
Parent:
13:920e00014ee3
Child:
21:b92006c5b9ff
--- 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;
 }