Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions pkg/tinydtls/contrib/sock_dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,10 @@ ssize_t sock_dtls_send(sock_dtls_t *sock, sock_dtls_session_t *remote,
ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote,
void *data, size_t max_len, uint32_t timeout)
{
xtimer_t timeout_timer;

assert(sock);
assert(data);
assert(remote);

if ((timeout != SOCK_NO_TIMEOUT) && (timeout != 0)) {
timeout_timer.callback = _timeout_callback;
timeout_timer.arg = sock;
xtimer_set(&timeout_timer, timeout);
}

/* save location to result buffer */
sock->buf = data;
sock->buflen = max_len;
Expand All @@ -409,7 +401,6 @@ ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote,
&remote->ep);
if (res <= 0) {
DEBUG("sock_dtls: error receiving UDP packet: %zd\n", res);
xtimer_remove(&timeout_timer);
return res;
}

Expand All @@ -427,7 +418,6 @@ ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote,
if (mbox_try_get(&sock->mbox, &msg)) {
switch(msg.type) {
case DTLS_EVENT_READ:
xtimer_remove(&timeout_timer);
return msg.content.value;
case DTLS_EVENT_TIMEOUT:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the timer removed, we don't need to handle DTLS_EVENT_TIMEOUT anymore. Maybe also lose the switch case.

DEBUG("sock_dtls: timed out while decrypting message\n");
Expand Down