Bugfix: keep track of receiver being awake as a local variable rather than a global, as it may have changed between invokations

This commit is contained in:
Adam Dunkels 2013-03-17 23:35:39 +01:00
parent 0670a8e1e2
commit 82b755c017

View file

@ -116,8 +116,6 @@ struct hdr {
/* Are we currently receiving a burst? */
static int we_are_receiving_burst = 0;
/* Has the receiver been awoken by a burst we're sending? */
static int is_receiver_awake = 0;
/* BURST_RECV_TIME is the maximum time a receiver waits for the
next packet of a burst when FRAME_PENDING is set. */
@ -854,7 +852,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
static void
qsend_packet(mac_callback_t sent, void *ptr)
{
int ret = send_packet(sent, ptr, NULL);
int ret = send_packet(sent, ptr, NULL, 0);
if(ret != MAC_TX_DEFERRED) {
mac_call_sent_callback(sent, ptr, ret, 1);
}
@ -866,6 +864,8 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
struct rdc_buf_list *curr = buf_list;
struct rdc_buf_list *next;
int ret;
int is_receiver_awake;
if(curr == NULL) {
return;
}
@ -889,7 +889,7 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
}
/* Send the current packet */
ret = send_packet(sent, ptr, curr);
ret = send_packet(sent, ptr, curr, is_receiver_awake);
if(ret != MAC_TX_DEFERRED) {
mac_call_sent_callback(sent, ptr, ret, 1);
}
@ -905,7 +905,6 @@ qsend_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *buf_list)
next = NULL;
}
} while(next != NULL);
is_receiver_awake = 0;
}
/*---------------------------------------------------------------------------*/
/* Timer callback triggered when receiving a burst, after having