Bugfix: energy consumption for retransmissions was miscounted

This commit is contained in:
Adam Dunkels 2011-04-13 14:10:39 +02:00
parent af4ce9ba9e
commit 74f1754d88

View File

@ -241,6 +241,13 @@ packet_sent(void *ptr, int status, int num_transmissions)
PRINTF("csma: retransmitting with time %lu %p\n", time, q);
ctimer_set(&transmit_timer, time,
transmit_queued_packet, NULL);
/* This is needed to correctly attribute energy that we spent
transmitting this packet. */
q = list_head(queued_packet_list);
queuebuf_free(q->buf);
q->buf = queuebuf_new_from_packetbuf();
} else {
PRINTF("csma: drop with status %d after %d transmissions, %d collisions\n",
status, q->transmissions, q->collisions);