Closed AxelLin closed 3 years ago
@AxelLin But the client still disconnects after this error, or? I think we abort connection if the mqtt_write_data()
not ESP_OK
. The reason could be that the connection terminated in a clean way, with the FIN
flag, in that case the errno
would be 0
.
Yes, in general we'd like add records for these three "errors" that are not reflected in sockets' errno (on the tcp-transport layer)
FIN
flag
Sometimes I got MQTT_EVENT_ERROR with error_type MQTT_ERROR_TYPE_TCP_TRANSPORT. But all the errors (esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags, sock_errno) shows 0. I didn't use TLS in my test, so I'm not surprised the esptls* are 0, but sock_errno is also 0, this is quite confusing.
It looks like this happen when mqtt_write_data esp_transport_write returns 0. i.e. MQTT_CLIENT: Error write data or timeout, written len = 0, errno=0
When disable ESP_LOG, there is no good way to know what's wrong if all the err fields are 0. So I'm wondering if there is some way to improve this.