Skip to content

Commit

Permalink
Contiki-NG: Renamings to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrentz authored and mrdeep1 committed Oct 13, 2023
1 parent 9bb8860 commit d61713d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/coap3/coap_net_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct coap_context_t {

#ifdef WITH_CONTIKI
struct uip_udp_conn *conn; /**< uIP connection object */
struct ctimer prepare_timer; /**< fires when it's time to call
struct ctimer io_timer; /**< fires when it's time to call
coap_io_prepare_io */
#endif /* WITH_CONTIKI */

Expand Down
18 changes: 9 additions & 9 deletions src/coap_io_contiki.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ coap_stop_io_process(void) {
}

static void
on_prepare_timer_expired(void *ptr) {
on_io_timer_expired(void *ptr) {
PROCESS_CONTEXT_BEGIN(&libcoap_io_process);
prepare_io((coap_context_t *)ptr);
PROCESS_CONTEXT_END(&libcoap_io_process);
}

void
coap_update_io_timer(coap_context_t *ctx, coap_tick_t delay) {
if (!ctimer_expired(&ctx->prepare_timer)) {
ctimer_stop(&ctx->prepare_timer);
if (!ctimer_expired(&ctx->io_timer)) {
ctimer_stop(&ctx->io_timer);
}
if (!delay) {
process_post(&libcoap_io_process, PROCESS_EVENT_POLL, ctx);
} else {
ctimer_set(&ctx->prepare_timer,
ctimer_set(&ctx->io_timer,
CLOCK_SECOND * delay / 1000,
on_prepare_timer_expired,
on_io_timer_expired,
ctx);
}
}
Expand All @@ -58,12 +58,12 @@ prepare_io(coap_context_t *ctx) {
coap_socket_t *sockets[1];
static const unsigned int max_sockets = sizeof(sockets)/sizeof(sockets[0]);
unsigned int num_sockets;
unsigned timeout;
unsigned next_io;

coap_ticks(&now);
timeout = coap_io_prepare_io(ctx, sockets, max_sockets, &num_sockets, now);
if (timeout) {
coap_update_io_timer(ctx, timeout);
next_io = coap_io_prepare_io(ctx, sockets, max_sockets, &num_sockets, now);
if (next_io) {
coap_update_io_timer(ctx, next_io);
}
}

Expand Down

0 comments on commit d61713d

Please sign in to comment.