Skip to content

Commit

Permalink
gnrc netapi: switch to non-blocking IPC calls
Browse files Browse the repository at this point in the history
This is quite a major change for GNRC, but should prevent the system to hang completely due to full message queues.
  • Loading branch information
OlegHahm committed Oct 1, 2015
1 parent 4e05254 commit 6532a76
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sys/net/gnrc/netapi/gnrc_netapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include "net/gnrc/pktbuf.h"
#include "net/gnrc/netapi.h"

#define ENABLE_DEBUG (0)
#include "debug.h"

/**
* @brief Unified function for getting and setting netapi options
*
Expand Down Expand Up @@ -63,7 +66,12 @@ static inline int _snd_rcv(kernel_pid_t pid, uint16_t type, gnrc_pktsnip_t *pkt)
msg.type = type;
msg.content.ptr = (void *)pkt;
/* send message */
return msg_send(&msg, pid);
int ret = msg_try_send(&msg, pid);
if (ret < 1) {
DEBUG("gnrc_netapi: dropped message to %" PRIkernel_pid " (%s)\n", pid,
(ret == 0) ? "receiver queue is full" : "invalid receiver");
}
return ret;
}

int gnrc_netapi_dispatch(gnrc_nettype_t type, uint32_t demux_ctx,
Expand Down

0 comments on commit 6532a76

Please sign in to comment.