diff options
| author | Garrett D'Amore <garrett@damore.org> | 2025-09-14 17:21:00 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-09-14 17:21:00 -0700 |
| commit | f716f61c81a5f120d61b58ee9b4a52b33b2ecb16 (patch) | |
| tree | 85adc8827e1a2f81c3030ec4a32740315d6e7f1c | |
| parent | d32abc2d5944637372f6ba597575ed17b14b974e (diff) | |
| download | nng-f716f61c81a5f120d61b58ee9b4a52b33b2ecb16.tar.gz nng-f716f61c81a5f120d61b58ee9b4a52b33b2ecb16.tar.bz2 nng-f716f61c81a5f120d61b58ee9b4a52b33b2ecb16.zip | |
Fix dtls reconnect attempts.
Once a DTLS client is started and has reasonably resolved things, it
will restart message connections; this way we can restart after a
failed connection attempt (e.g. if the CERT was bad or something.)
| -rw-r--r-- | src/sp/transport/dtls/dtls.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sp/transport/dtls/dtls.c b/src/sp/transport/dtls/dtls.c index bcfab6c7..e95560de 100644 --- a/src/sp/transport/dtls/dtls.c +++ b/src/sp/transport/dtls/dtls.c @@ -1134,7 +1134,8 @@ dtls_ep_stop(void *arg) nni_aio_stop(&ep->timeaio); nni_mtx_lock(&ep->mtx); - ep->fini = true; + ep->fini = true; + ep->started = false; nni_mtx_unlock(&ep->mtx); } @@ -1440,18 +1441,21 @@ dtls_ep_connect(void *arg, nni_aio *aio) nni_mtx_unlock(&ep->mtx); return; } - if (ep->started) { + if (!nni_list_empty(&ep->connaios)) { nni_aio_finish_error(aio, NNG_EBUSY); nni_mtx_unlock(&ep->mtx); return; } - NNI_ASSERT(nni_list_empty(&ep->connaios)); ep->dialer = true; - + NNI_ASSERT(nni_list_empty(&ep->connaios)); nni_list_append(&ep->connaios, aio); - // lookup the IP address + if (ep->started) { + nni_mtx_unlock(&ep->mtx); + return; + } + // lookup the IP address memset(&ep->resolv, 0, sizeof(ep->resolv)); ep->resolv.ri_family = ep->af; ep->resolv.ri_host = ep->url->u_hostname; |
