Send an announcement packet only if there are more than zero announcemnets

This commit is contained in:
adamdunkels 2009-03-23 16:19:03 +00:00
parent 7da12552cd
commit c791d851bb

View file

@ -33,7 +33,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: polite-announcement.c,v 1.2 2009/03/12 21:58:21 adamdunkels Exp $ * $Id: polite-announcement.c,v 1.3 2009/03/23 16:19:03 adamdunkels Exp $
*/ */
/** /**
@ -108,7 +108,10 @@ send_adv(clock_time_t interval)
PRINTF("%d.%d: sending neighbor advertisement with %d announcements\n", PRINTF("%d.%d: sending neighbor advertisement with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], adata->num); rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], adata->num);
ipolite_send(&c.c, interval, packetbuf_datalen()); if(adata->num > 0) {
/* Send the packet if it contains more than one announcement. */
ipolite_send(&c.c, interval, packetbuf_datalen());
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void