Call disconnect callback on TLS error.

When using the library asynchronously, TLS errors caused e.g. because
of the date/time not set correctly, cause the connection to be silently
dropped without the disconnection callback being invoked, as described
in issue #1052.

This commit fixes the issue, returning the behavior to the one the
library had previous to version 1.5.4, if a TLS error occurs, the
disconnect callback will be invoked for the client to get notified of
the error.

Signed-off-by: doragasu <doragasu@protonmail.com>
This commit is contained in:
doragasu 2021-09-16 17:06:55 +02:00
parent d942ed7eec
commit 4471ee9e47

View File

@ -373,7 +373,11 @@ int mosquitto_loop_read(struct mosquitto *mosq, int max_packets)
#ifdef WITH_TLS
if(mosq->want_connect){
return net__socket_connect_tls(mosq);
rc = net__socket_connect_tls(mosq);
if (MOSQ_ERR_TLS == rc){
rc = mosquitto__loop_rc_handle(mosq, rc);
}
return rc;
}
#endif