From 48b1eff004c201df3a754fa0ebab0e7f9d82579b Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 30 Jan 2019 20:27:10 +0100 Subject: [PATCH] coap_session.[hc]: make argument of coap_session_max_pdu_size() const As the session object passed to coap_session_max_pdu_size() is not modified it should be const. --- include/coap2/coap_session.h | 2 +- src/coap_session.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/coap2/coap_session.h b/include/coap2/coap_session.h index 15140378..1fddebc8 100644 --- a/include/coap2/coap_session.h +++ b/include/coap2/coap_session.h @@ -160,7 +160,7 @@ void coap_session_set_mtu(coap_session_t *session, unsigned mtu); * @param session The CoAP session. * @return maximum PDU size, not including header (but including token). */ -size_t coap_session_max_pdu_size(coap_session_t *session); +size_t coap_session_max_pdu_size(const coap_session_t *session); /** * Creates a new client session to the designated server. diff --git a/src/coap_session.c b/src/coap_session.c index 49b1517a..9fc52e0e 100644 --- a/src/coap_session.c +++ b/src/coap_session.c @@ -186,7 +186,7 @@ void coap_session_free(coap_session_t *session) { coap_free_type(COAP_SESSION, session); } -size_t coap_session_max_pdu_size(coap_session_t *session) { +size_t coap_session_max_pdu_size(const coap_session_t *session) { size_t max_with_header = (size_t)(session->mtu - session->tls_overhead); if (COAP_PROTO_NOT_RELIABLE(session->proto)) return max_with_header > 4 ? max_with_header - 4 : 0;