diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index 6a82e3717..e2776e35d 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -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);