l2cap: ignore packets_granted for outgoing data

This commit is contained in:
Matthias Ringwald 2015-12-06 21:52:25 +01:00
parent 5167f4e2d9
commit 29b32c60a3

View File

@ -250,7 +250,6 @@ static l2cap_channel_t * l2cap_get_channel_for_local_cid(uint16_t local_cid){
int l2cap_can_send_packet_now(uint16_t local_cid){
l2cap_channel_t *channel = l2cap_get_channel_for_local_cid(local_cid);
if (!channel) return 0;
if (!channel->packets_granted) return 0;
return hci_can_send_acl_packet_now(channel->handle);
}
@ -394,17 +393,14 @@ int l2cap_send_prepared(uint16_t local_cid, uint16_t len){
return -1; // TODO: define error
}
if (channel->packets_granted == 0){
log_error("l2cap_send_prepared cid 0x%02x, no credits!", local_cid);
return -1; // TODO: define error
}
if (!hci_can_send_prepared_acl_packet_now(channel->handle)){
log_info("l2cap_send_prepared cid 0x%02x, cannot send", local_cid);
return BTSTACK_ACL_BUFFERS_FULL;
}
--channel->packets_granted;
if (channel->packets_granted){
--channel->packets_granted;
}
log_debug("l2cap_send_prepared cid 0x%02x, handle %u, 1 credit used, credits left %u;",
local_cid, channel->handle, channel->packets_granted);