this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Branch:
PassingRegression
Revision:
125:d2830421006c
Parent:
124:eae4512b131b
Child:
126:9bc33f8b57d5
--- a/source/WiFiManager.cpp	Sat Jun 15 15:52:26 2019 +0000
+++ b/source/WiFiManager.cpp	Thu Jun 20 20:46:25 2019 +0000
@@ -276,7 +276,6 @@
                 while(secCount++ < WIFI_CONNECT_TIMEOUT_SECS && is_connected==false){
                     wait(1); // wait 1 sec
                 }
-                wifiCmd = WIFI_CMD_NONE;
                 if(is_connected==false){
                     if(outputBuffersAvailable() == false) // first free it
                     {
@@ -291,6 +290,7 @@
                 else {
                     sendATresponseString(AT_CONNECT_RESP);
                 }
+                wifiCmd = WIFI_CMD_NONE;
                 wifiBusy = 0;
                 break;
             }
@@ -303,7 +303,6 @@
                 }
                 wifiBusy = 1;
                 error = disconnect();
-                wifiCmd = WIFI_CMD_NONE;
                 if(error >= 0)
                 {
                     int secCount = 0;
@@ -325,9 +324,11 @@
                     // attempt reconnection if always connected scheme is set
                     if(internet_config->connectionScheme == ALWAYS_CONNECTED)
                     {
+                        wifiCmd = WIFI_CMD_NONE;
                         setNextCommand(WIFI_CMD_CONNECT);
                     }
                 }
+                wifiCmd = WIFI_CMD_NONE;
                 wifiBusy = 0;
                 break;
             }
@@ -348,7 +349,7 @@
                 callback_semaphore.wait();
 #endif
                 int msecCount = 0;
-                while(!backgroundTaskCompleted && msecCount < 1000)
+                while(!backgroundTaskCompleted && msecCount < 2000)
                 {
                     msecCount++;
                     wait_ms(10);
@@ -1007,13 +1008,19 @@
         int i = 0;
         responseBytes[i++] = IPv4_CONNECTION; // connect type IPv4
         responseBytes[i++] = TCP_PROTOCOL; // Protocol = TCP
+        dbg_printf(LOG, "Buffer available \r\n");
         if(is_connected && result>=0)
         {
             memcpy(&responseBytes[i], address->get_ip_bytes(), 4); // remote IPv4 address
+            dbg_printf(LOG, "IP Address OK \r\n");
             strcpy(internet_config->remote_IPv4Address, address->get_ip_address());
+            dbg_printf(LOG, "Remote IP address OK \r\n");
             i +=4;
             uint16_t port = address->get_port();
+            delete address;
+            dbg_printf(LOG, "Port OK \r\n");
             internet_config->remote_port = port;
+            dbg_printf(LOG, "Remote port OK \r\n");
             memcpy(&responseBytes[i], &port, 2); // remote IPv4 port #
             i +=2;
             // local IPv4 address
@@ -1029,6 +1036,7 @@
             responseBytes[i++] = 0;
             responseBytes[i]   = 0;
             printBufferInHex(responseBytes, HOSTNAME_RESPONSE_LEN);
+            dbg_printf(LOG, "About to send response bytes... \r\n");
             sendATresponseBytes(CONNECT_EVENT, HOSTNAME_RESPONSE_LEN);
         }
         else