aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport/dtls
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-11-10 20:24:27 -0800
committerGarrett D'Amore <garrett@damore.org>2025-11-10 20:24:27 -0800
commit7291d128b5c33377283d7a1f2cd13b615f5b0b10 (patch)
tree0258f4c8b6550a3112c7364718734d6c7497f3e5 /src/sp/transport/dtls
parentc9e4b41e109b03ca9ffcf789f8278705451026c7 (diff)
downloadnng-main.tar.gz
nng-main.tar.bz2
nng-main.zip
fix/dtls: Fix possible ordering of DTLS messages during handshakes.HEADmain
Diffstat (limited to 'src/sp/transport/dtls')
-rw-r--r--src/sp/transport/dtls/dtls.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sp/transport/dtls/dtls.c b/src/sp/transport/dtls/dtls.c
index bcc61ce5..fdba5308 100644
--- a/src/sp/transport/dtls/dtls.c
+++ b/src/sp/transport/dtls/dtls.c
@@ -979,7 +979,6 @@ dtls_rx_cb(void *arg)
goto fail;
}
memcpy(nni_msg_body(msg), ep->rx_buf, len);
- dtls_start_rx(ep);
nni_pipe_hold(p->npipe);
nni_mtx_unlock(&ep->mtx);
@@ -1001,6 +1000,10 @@ dtls_rx_cb(void *arg)
nni_pipe_close(p->npipe);
}
nni_pipe_rele(p->npipe);
+
+ nni_mtx_lock(&ep->mtx);
+ dtls_start_rx(ep);
+ nni_mtx_unlock(&ep->mtx);
return;
fail:
@@ -1187,7 +1190,7 @@ dtls_timer_cb(void *arg)
if (p->dialer && now > p->next_refresh) {
p->send_op = OPCODE_CREQ;
- p->next_refresh = p->expire + p->refresh;
+ p->next_refresh = now + p->refresh;
dtls_pipe_send_tls(p);
}
if (refresh == NNG_DURATION_INFINITE && p->refresh > 0) {