1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 17:43:51 +01:00

Revert "gnrc/netreg: remove usages of gnrc_netreg_num"

This reverts commit c2b403f4ad0fda2e196be248406f2c04d626cf26.
This commit is contained in:
Martine Lenders 2018-02-22 20:30:03 +01:00
parent 2757f1d7dd
commit dbda759b40
3 changed files with 41 additions and 39 deletions

View File

@ -367,7 +367,7 @@ int _tftp_init_ctxt(ipv6_addr_t *addr, const char *file_name,
/* generate a random source UDP source port */
do {
ctxt->src_port = (random_uint32() & 0xff) + GNRC_TFTP_DEFAULT_SRC_PORT;
} while (gnrc_netreg_lookup(GNRC_NETTYPE_UDP, ctxt->src_port));
} while (gnrc_netreg_num(GNRC_NETTYPE_UDP, ctxt->src_port));
return TS_FINISHED;
}

View File

@ -94,13 +94,14 @@ static inline int _snd_rcv_mbox(mbox_t *mbox, uint16_t type, gnrc_pktsnip_t *pkt
int gnrc_netapi_dispatch(gnrc_nettype_t type, uint32_t demux_ctx,
uint16_t cmd, gnrc_pktsnip_t *pkt)
{
int numof = 0;
int numof = gnrc_netreg_num(type, demux_ctx);
if (numof != 0) {
gnrc_netreg_entry_t *sendto = gnrc_netreg_lookup(type, demux_ctx);
gnrc_pktbuf_hold(pkt, numof - 1);
while (sendto) {
if (numof != 0) {
gnrc_pktbuf_hold(pkt, 1);
}
#if defined(MODULE_GNRC_NETAPI_MBOX) || defined(MODULE_GNRC_NETAPI_CALLBACKS)
int release = 0;
switch (sendto->type) {
@ -137,9 +138,10 @@ int gnrc_netapi_dispatch(gnrc_nettype_t type, uint32_t demux_ctx,
gnrc_pktbuf_release(pkt);
}
#endif
numof++;
sendto = gnrc_netreg_getnext(sendto);
}
}
return numof;
}

View File

@ -219,7 +219,7 @@ static void _dispatch_next_header(gnrc_pktsnip_t *current, gnrc_pktsnip_t *pkt,
/* dispatch IPv6 extension header only once */
if (should_dispatch_current_type) {
bool should_release = (!gnrc_netreg_lookup(GNRC_NETTYPE_IPV6, nh)) &&
bool should_release = (gnrc_netreg_num(GNRC_NETTYPE_IPV6, nh) == 0) &&
(!interested);
if (!should_release) {