Send announcement packets only if there are any announcements to send
This commit is contained in:
parent
f4b8680174
commit
1cbc0f4ea9
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: xmac.c,v 1.28 2009/03/12 21:58:20 adamdunkels Exp $
|
* $Id: xmac.c,v 1.29 2009/03/23 21:00:25 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -342,8 +342,12 @@ format_announcement(char *hdr)
|
||||||
adata->num++;
|
adata->num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(adata->num > 0) {
|
||||||
return ANNOUNCEMENT_MSG_HEADERLEN +
|
return ANNOUNCEMENT_MSG_HEADERLEN +
|
||||||
sizeof(struct announcement_data) * adata->num;
|
sizeof(struct announcement_data) * adata->num;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* XMAC_CONF_ANNOUNCEMENTS */
|
#endif /* XMAC_CONF_ANNOUNCEMENTS */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -698,10 +702,10 @@ send_announcement(void *ptr)
|
||||||
announcement_len = format_announcement((char *)hdr +
|
announcement_len = format_announcement((char *)hdr +
|
||||||
sizeof(struct xmac_hdr));
|
sizeof(struct xmac_hdr));
|
||||||
|
|
||||||
|
if(announcement_len > 0) {
|
||||||
packetbuf_set_datalen(sizeof(struct xmac_hdr) + announcement_len);
|
packetbuf_set_datalen(sizeof(struct xmac_hdr) + announcement_len);
|
||||||
|
|
||||||
/* PRINTF("Sending probe\n");*/
|
|
||||||
radio->send(packetbuf_hdrptr(), packetbuf_totlen());
|
radio->send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue