DTLS: Correctly log sending plain data size when using DTLS

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-01-06 15:01:39 +00:00
1 parent 75b4322b0f
commit bd2c2b04f8
3 files changed
+6 -12

No files matched your search

+2 -4
View File
@@ -2485,6 +2485,8 @@ coap_dtls_receive(coap_session_t *c_session, const uint8_t *data,
}
ret = gnutls_record_recv(g_env->g_session, pdu, (int)sizeof(pdu));
if (ret > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(c_session), ret);
return coap_handle_dgram(c_session->context, c_session, pdu, (size_t)ret);
} else if (ret == 0) {
c_session->dtls_event = COAP_EVENT_DTLS_CLOSED;
@@ -2542,10 +2544,6 @@ coap_dtls_receive(coap_session_t *c_session, const uint8_t *data,
ssl_data->pdu_len = 0;
ssl_data->pdu = NULL;
}
if (ret > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(c_session), ret);
}
return ret;
}
+2 -4
View File
@@ -2396,6 +2396,8 @@ coap_dtls_receive(coap_session_t *c_session,
ret = mbedtls_ssl_read(&m_env->ssl, pdu, sizeof(pdu));
if (ret > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(c_session), ret);
ret = coap_handle_dgram(c_session->context, c_session, pdu, (size_t)ret);
goto finish;
}
@@ -2449,10 +2451,6 @@ finish:
ssl_data->pdu_len = 0;
ssl_data->pdu = NULL;
}
if (ret > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(c_session), ret);
}
return ret;
}
+2 -4
View File
@@ -3662,6 +3662,8 @@ coap_dtls_receive(coap_session_t *session, const uint8_t *data, size_t data_len)
session->dtls_event = -1;
r = SSL_read(ssl, pdu, (int)sizeof(pdu));
if (r > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(session), r);
r = coap_handle_dgram(session->context, session, pdu, (size_t)r);
goto finished;
} else {
@@ -3701,10 +3703,6 @@ finished:
ssl_data->pdu_len = 0;
ssl_data->pdu = NULL;
}
if (r > 0) {
coap_log_debug("* %s: dtls: recv %4d bytes\n",
coap_session_str(session), r);
}
return r;
}