only grant credits on open connections

This commit is contained in:
matthias.ringwald 2010-07-30 20:21:19 +00:00
parent 0535257c6f
commit c3b820cfe6

View File

@ -152,6 +152,7 @@ void l2cap_hand_out_credits(){
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
if (!hci_number_free_acl_slots()) return;
if (channel->state != L2CAP_STATE_OPEN) continue;
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if (hci_number_outgoing_packets(channel->handle) < 2 && channel->packets_granted == 0) {
l2cap_emit_credits(channel, 1);