Merge pull request #192 from cquijano/dtls_event_on_error

coap_tinydtls.c: On DTLS error, fire and event that could be catch by upper layers
This commit is contained in:
obgm authored and GitHub committed 2018-05-31 10:43:12 +02:00
commit 282fd96fc3
1 file changed
+7 -3
+7 -3
View File
@@ -388,13 +388,17 @@ coap_dtls_receive(coap_session_t *session,
size_t data_len
) {
session_t *dtls_session = (session_t *)session->tls;
int res;
int err;
coap_event_dtls = -1;
res = dtls_handle_message(
err = dtls_handle_message(
(struct dtls_context_t *)session->context->dtls_context,
dtls_session, (uint8 *)data, (int)data_len);
if (err){
coap_event_dtls = COAP_EVENT_DTLS_ERROR;
}
if (coap_event_dtls >= 0) {
coap_handle_event(session->context, coap_event_dtls, session);
if (coap_event_dtls == COAP_EVENT_DTLS_CONNECTED)
@@ -403,7 +407,7 @@ coap_dtls_receive(coap_session_t *session,
coap_session_disconnected(session, COAP_NACK_TLS_FAILED);
}
return res;
return err;
}
int