mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-08-15 12:27:50 +00:00
Fix for #1165
It is possible that packetbuf is modified by the call to mac_call_sent_callback. If this occurs ContikiMAC will not be able to recognize that a packet is pending. This fixes this problem by storing pending status in a local variable before calling mac_call_sent_callback.
This commit is contained in:
@@ -805,6 +805,7 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
|||||||
struct rdc_buf_list *next;
|
struct rdc_buf_list *next;
|
||||||
int ret;
|
int ret;
|
||||||
int is_receiver_awake;
|
int is_receiver_awake;
|
||||||
|
int pending;
|
||||||
|
|
||||||
if(buf_list == NULL) {
|
if(buf_list == NULL) {
|
||||||
return;
|
return;
|
||||||
@@ -850,6 +851,8 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
|||||||
/* Prepare the packetbuf */
|
/* Prepare the packetbuf */
|
||||||
queuebuf_to_packetbuf(curr->buf);
|
queuebuf_to_packetbuf(curr->buf);
|
||||||
|
|
||||||
|
pending = packetbuf_attr(PACKETBUF_ATTR_PENDING);
|
||||||
|
|
||||||
/* Send the current packet */
|
/* Send the current packet */
|
||||||
ret = send_packet(sent, ptr, curr, is_receiver_awake);
|
ret = send_packet(sent, ptr, curr, is_receiver_awake);
|
||||||
if(ret != MAC_TX_DEFERRED) {
|
if(ret != MAC_TX_DEFERRED) {
|
||||||
@@ -866,7 +869,7 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
|
|||||||
/* The transmission failed, we stop the burst */
|
/* The transmission failed, we stop the burst */
|
||||||
next = NULL;
|
next = NULL;
|
||||||
}
|
}
|
||||||
} while((next != NULL) && packetbuf_attr(PACKETBUF_ATTR_PENDING));
|
} while((next != NULL) && pending);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Timer callback triggered when receiving a burst, after having
|
/* Timer callback triggered when receiving a burst, after having
|
||||||
|
Reference in New Issue
Block a user