Optimized transmission when interval == 0

This commit is contained in:
adamdunkels 2008-01-25 01:06:25 +00:00
parent 28a3a51f82
commit c576b7b01c

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: ipolite.c,v 1.5 2008/01/24 21:10:50 adamdunkels Exp $ * $Id: ipolite.c,v 1.6 2008/01/25 01:06:25 adamdunkels Exp $
*/ */
/** /**
@ -135,13 +135,17 @@ ipolite_send(struct ipolite_conn *c, clock_time_t interval, u8_t hdrsize)
queuebuf_free(c->q); queuebuf_free(c->q);
} }
c->hdrsize = hdrsize; c->hdrsize = hdrsize;
c->q = queuebuf_new_from_rimebuf(); if(interval == 0) {
if(c->q != NULL) { PRINTF("%d.%d: ipolite_send: interval 0\n",
if(interval == 0) { rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
PRINTF("%d.%d: ipolite_send: interval 0\n", ibc_send(&c->c);
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]); if(c->cb->sent) {
send(c); c->cb->sent(c);
} else { }
return 1;
} else {
c->q = queuebuf_new_from_rimebuf();
if(c->q != NULL) {
ctimer_set(&c->t, ctimer_set(&c->t,
interval / 2 + (random_rand() % (interval / 2)), interval / 2 + (random_rand() % (interval / 2)),
send, c); send, c);