Skip to content

Commit

Permalink
pw_bluetooth_proxy: Log why GATT send is unavailable
Browse files Browse the repository at this point in the history
Bug: 362995008
Change-Id: I643beefb48cfd68a3d8f34364c891268bba23ba6
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/232951
Commit-Queue: David Rees <[email protected]>
Reviewed-by: Ali Saeed <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Pigweed-Auto-Submit: David Rees <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
studgeek authored and CQ Bot Account committed Aug 30, 2024
1 parent 6829156 commit f35a192
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pw_bluetooth_proxy/acl_data_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ uint16_t AclDataChannel::GetNumFreeLeAclPackets() const {
bool AclDataChannel::SendAcl(H4PacketWithH4&& h4_packet) {
credit_allocation_mutex_.lock();
if (proxy_pending_le_acl_packets_ == proxy_max_le_acl_packets_) {
PW_LOG_WARN("No ACL send credits available. So will not send.");
credit_allocation_mutex_.unlock();
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions pw_bluetooth_proxy/proxy_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ pw::Status ProxyHost::SendGattNotify(uint16_t connection_handle,
acl_send_mutex_.lock();
std::optional<span<uint8_t>> h4_buff = ReserveH4Buff();
if (!h4_buff) {
PW_LOG_WARN("No H4 buffers available. So will not send.");
acl_send_mutex_.unlock();
return pw::Status::Unavailable();
}
Expand Down Expand Up @@ -222,6 +223,7 @@ pw::Status ProxyHost::SendGattNotify(uint16_t connection_handle,
// destructed, so its release function will clear the corresponding flag in
// `h4_buff_occupied_`.
if (!acl_data_channel_.SendAcl(std::move(h4_att_notify))) {
// SendAcl function will have logged reason for failure to send..
return pw::Status::Unavailable();
}
return OkStatus();
Expand Down

0 comments on commit f35a192

Please sign in to comment.