att_dispatch: fix bug in round robin between

This commit is contained in:
Matthias Ringwald 2018-02-19 15:28:11 +01:00
parent 0fbf59a1c1
commit 1dab9fd639

View File

@ -81,8 +81,8 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa
if (subscriptions[index].packet_handler && subscriptions[index].waiting_for_can_send){
subscriptions[index].waiting_for_can_send = 0;
subscriptions[index].packet_handler(packet_type, handle, packet, size);
// fairness
att_round_robin = 1 - index;
// fairness: prioritize next service
att_round_robin = (index + 1) % ATT_MAX;
// stop if client cannot send anymore
if (!hci_can_send_acl_le_packet_now()) break;
}
@ -90,7 +90,7 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa
// check if more can send now events are needed
if (!can_send_now_pending){
for (i = 0; i < ATT_MAX; i++){
if (subscriptions[index].waiting_for_can_send){
if (subscriptions[i].waiting_for_can_send){
can_send_now_pending = 1;
// note: con_handle is not used, so we can pass in anything
l2cap_request_can_send_fix_channel_now_event(0, L2CAP_CID_ATTRIBUTE_PROTOCOL);