mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/tinydtls/sock_dtls: use ztimer_usec
This commit is contained in:
parent
73e7eacf22
commit
a3d58c6dcd
@ -12,4 +12,5 @@ FEATURES_REQUIRED += arch_32bit
|
||||
|
||||
ifneq (,$(filter sock_dtls,$(USEMODULE)))
|
||||
USEMODULE += tinydtls_sock_dtls
|
||||
USEMODULE += ztimer_usec
|
||||
endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "log.h"
|
||||
#include "net/sock/dtls.h"
|
||||
#include "net/credman.h"
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#if SOCK_HAS_ASYNC
|
||||
#include "net/sock/async.h"
|
||||
@ -624,8 +624,8 @@ ssize_t sock_dtls_send_aux(sock_dtls_t *sock, sock_dtls_session_t *remote,
|
||||
msg_t msg;
|
||||
bool is_timed_out = false;
|
||||
do {
|
||||
uint32_t start = xtimer_now_usec();
|
||||
res = xtimer_msg_receive_timeout(&msg, timeout);
|
||||
uint32_t start = ztimer_now(ZTIMER_USEC);
|
||||
res = ztimer_msg_receive_timeout(ZTIMER_USEC, &msg, timeout);
|
||||
|
||||
if (timeout != SOCK_NO_TIMEOUT) {
|
||||
timeout = _update_timeout(start, timeout);
|
||||
@ -768,7 +768,7 @@ ssize_t sock_dtls_recv_aux(sock_dtls_t *sock, sock_dtls_session_t *remote,
|
||||
/* loop breaks when timeout or application data read */
|
||||
while (1) {
|
||||
ssize_t res;
|
||||
uint32_t start_recv = xtimer_now_usec();
|
||||
uint32_t start_recv = ztimer_now(ZTIMER_USEC);
|
||||
msg_t msg;
|
||||
|
||||
if (sock->buffer.data != NULL) {
|
||||
@ -840,7 +840,7 @@ static void _session_to_ep(const session_t *session, sock_udp_ep_t *ep)
|
||||
|
||||
static inline uint32_t _update_timeout(uint32_t start, uint32_t timeout)
|
||||
{
|
||||
uint32_t diff = (xtimer_now_usec() - start);
|
||||
uint32_t diff = (ztimer_now(ZTIMER_USEC) - start);
|
||||
|
||||
return (diff > timeout) ? 0: timeout - diff;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user