cesanta / mongoose-os

Mongoose OS - an IoT Firmware Development Framework. Supported microcontrollers: ESP32, ESP8266, CC3220, CC3200, STM32F4, STM32L4, STM32F7. Amazon AWS IoT, Microsoft Azure, Google IoT Core integrated. Code in C or JavaScript.
https://mongoose-os.com
Other
2.51k stars 429 forks source link

Added MGOS_EVENT_CLOUD_CONNECTERROR #561

Closed markterrill closed 2 years ago

markterrill commented 3 years ago

This will have a related update in MQTT library, will post the related PR

rojer commented 3 years ago

we have MGOS_EVENT_CLOUD_DISCONNECTED, why is this needed?

markterrill commented 3 years ago

Hey Rojer. cloud_disconnected is a different event, MG_EV_CLOSE. MG_EV_CONNECT has a logging call but didn't raise a system event. MG_EV_CONNECT can actually result in a TCP connection error that didn't have a correlating event trigger. However a success would be picked up elsewhere (ie in GCP) as cloud connected.

LOG(LL_INFO, ("MQTT%d TCP connect %s (%d)", c->conn_id,
                    (status == 0 ? "ok" : "error"), status));

PS, I was actually the one who added cloud_disconnected. During testing I changed the port number of the GCP service so it couldn't connect and it's how I found out about this TCP error logic path.

markterrill commented 3 years ago

Can we please get this committed? Having key PR's still hanging is causing us headaches.

markterrill commented 3 years ago

I've closed the other PR as this one includes cloud error and cloud connecting. Have added the code note re MQTT.

rojer commented 2 years ago

superseded by #598