Skip to content

Commit

Permalink
coap_tinydtls.c: Fix server only build for CID
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed Sep 26, 2024
1 parent 79a6630 commit 3cba297
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/coap_tinydtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ coap_dtls_send(coap_session_t *session,
if (coap_event_dtls != COAP_EVENT_DTLS_CLOSED)
coap_handle_event_lkd(session->context, coap_event_dtls, session);
if (coap_event_dtls == COAP_EVENT_DTLS_CONNECTED) {
#if (DTLS_MAX_CID_LENGTH > 0)
#if (DTLS_MAX_CID_LENGTH > 0) && COAP_CLIENT_SUPPORT
if (session->type == COAP_SESSION_TYPE_CLIENT) {
dtls_peer_t *peer = dtls_get_peer(dtls_context, (session_t *)session->tls);
dtls_security_parameters_t *security = dtls_security_params(peer);
Expand All @@ -894,7 +894,7 @@ coap_dtls_send(coap_session_t *session,
session->negotiated_cid = 0;
}
}
#endif /* DTLS_MAX_CID_LENGTH > 0 */
#endif /* DTLS_MAX_CID_LENGTH > 0 && COAP_CLIENT_SUPPORT */
coap_session_connected(session);
} else if (coap_event_dtls == COAP_EVENT_DTLS_CLOSED || coap_event_dtls == COAP_EVENT_DTLS_ERROR) {
coap_session_disconnected_lkd(session, COAP_NACK_TLS_FAILED);
Expand Down Expand Up @@ -966,7 +966,7 @@ coap_dtls_receive(coap_session_t *session,
coap_handle_event_lkd(session->context, coap_event_dtls, session);
if (coap_event_dtls == COAP_EVENT_DTLS_CONNECTED) {
coap_session_connected(session);
#if (DTLS_MAX_CID_LENGTH > 0)
#if (DTLS_MAX_CID_LENGTH > 0) && COAP_CLIENT_SUPPORT
if (session->type == COAP_SESSION_TYPE_CLIENT) {
dtls_peer_t *peer = dtls_get_peer(dtls_context, (session_t *)session->tls);
dtls_security_parameters_t *security = dtls_security_params(peer);
Expand All @@ -977,7 +977,7 @@ coap_dtls_receive(coap_session_t *session,
session->negotiated_cid = 0;
}
}
#endif /* DTLS_MAX_CID_LENGTH > 0 */
#endif /* DTLS_MAX_CID_LENGTH > 0 && COAP_CLIENT_SUPPORT */
} else if (coap_event_dtls == COAP_EVENT_DTLS_CLOSED || coap_event_dtls == COAP_EVENT_DTLS_ERROR) {
coap_session_disconnected_lkd(session, COAP_NACK_TLS_FAILED);
err = -1;
Expand Down

0 comments on commit 3cba297

Please sign in to comment.