mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-19 22:19:05 +03:00
Add minimum timeout of 100ms for global DTLS timeout. Remove the peer from tinydtls retransmit list when the coap session is reset.
This commit is contained in:
1 parent
1d2e985364
commit
87126f35c1
2 files changed
+8
-4
No files matched your search
+2
-2
@@ -738,8 +738,8 @@ coap_write(coap_context_t *ctx,
|
||||
if (coap_dtls_is_context_timeout()) {
|
||||
coap_tick_t tls_timeout = coap_dtls_get_context_timeout(ctx->dtls_context);
|
||||
if (tls_timeout > 0) {
|
||||
if (tls_timeout < now)
|
||||
tls_timeout = now + 1;
|
||||
if (tls_timeout < now + COAP_TICKS_PER_SECOND / 10)
|
||||
tls_timeout = now + COAP_TICKS_PER_SECOND / 10;
|
||||
debug("** DTLS global timeout set to %dms\n", (int)((tls_timeout - now) * 1000 / COAP_TICKS_PER_SECOND));
|
||||
if (timeout == 0 || tls_timeout - now < timeout)
|
||||
timeout = tls_timeout - now;
|
||||
|
||||
+6
-2
@@ -321,9 +321,13 @@ coap_dtls_session_update_mtu(coap_session_t *session) {
|
||||
|
||||
void
|
||||
coap_dtls_free_session(coap_session_t *coap_session) {
|
||||
struct dtls_context_t *ctx = (struct dtls_context_t *)coap_session->context->dtls_context;
|
||||
if (coap_session->tls) {
|
||||
dtls_close((struct dtls_context_t *)coap_session->context->dtls_context,
|
||||
(session_t *)coap_session->tls);
|
||||
dtls_peer_t *peer = dtls_get_peer(ctx, (session_t *)coap_session->tls);
|
||||
if ( peer )
|
||||
dtls_reset_peer(ctx, peer);
|
||||
else
|
||||
dtls_close(ctx, (session_t *)coap_session->tls);
|
||||
debug("*** removed session %p\n", coap_session->tls);
|
||||
coap_free_type(COAP_DTLS_SESSION, coap_session->tls);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user