Skip to content

Commit

Permalink
Merge pull request #21 from embassy-rs/channel-storage-optimize
Browse files Browse the repository at this point in the history
reduce size of channel manager
  • Loading branch information
lulf authored Apr 23, 2024
2 parents 0b62ac6 + 2241a73 commit f19dc87
Show file tree
Hide file tree
Showing 6 changed files with 436 additions and 455 deletions.
21 changes: 4 additions & 17 deletions host/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use futures_intrusive::sync::LocalSemaphore;
use crate::advertise::{Advertisement, AdvertisementConfig, RawAdvertisement};
use crate::channel_manager::ChannelManager;
use crate::connection::{ConnectConfig, Connection};
use crate::connection_manager::{ConnectionInfo, ConnectionManager};
use crate::connection_manager::ConnectionManager;
use crate::cursor::WriteCursor;
use crate::l2cap::sar::PacketReassembly;
use crate::packet_pool::{AllocId, DynamicPacketPool, PacketPool, Qos};
Expand Down Expand Up @@ -537,7 +537,7 @@ where
// Avoids using the packet buffer for signalling packets
if header.channel == L2CAP_CID_LE_U_SIGNAL {
assert!(data.len() == header.length as usize);
self.channels.control(acl.handle(), &data).await?;
self.channels.signal(acl.handle(), &data).await?;
return Ok(());
}

Expand Down Expand Up @@ -697,20 +697,7 @@ where
Event::Le(event) => match event {
LeEvent::LeConnectionComplete(e) => match e.status.to_result() {
Ok(_) => {
if let Err(err) = self.connections.connect(
e.handle,
ConnectionInfo {
handle: e.handle,
status: e.status,
role: e.role,
peer_addr_kind: e.peer_addr_kind,
peer_address: e.peer_addr,
interval: e.conn_interval.as_u16(),
latency: e.peripheral_latency,
timeout: e.supervision_timeout.as_u16(),
att_mtu: 23,
},
) {
if let Err(err) = self.connections.connect(e.handle, &e) {
warn!("Error establishing connection: {:?}", err);
self.command(Disconnect::new(
e.handle,
Expand Down Expand Up @@ -747,7 +734,7 @@ where
disconnects += 1;
info!("Disconnected (total {}): {:?}", disconnects, e);
let _ = self.connections.disconnect(e.handle);
let _ = self.channels.disconnected_connection(e.handle);
let _ = self.channels.disconnected(e.handle);
}
Event::NumberOfCompletedPackets(c) => {
// info!("Confirmed {} packets sent", c.completed_packets.len());
Expand Down
Loading

0 comments on commit f19dc87

Please sign in to comment.