Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/win/src/ble_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ void BLEManager::OnGattSessionCreated(IAsyncOperation<GattSession> asyncOp, Asyn
peripheral.gattSession = session;
auto token = session.MaxPduSizeChanged(onPduSizeChanged);
peripheral.maxPduSizeChangedToken = token;

// Proactively maintain the GATT session so Windows establishes the
// physical connection up front. FromBluetoothAddressAsync returns
// before the link is up; without this the first GATT operation
// triggers the connection while the MTU is still the default 23,
// racing the peripheral's MTU exchange during service discovery.
// MaintainConnection defaults to false; the session is released in
// PeripheralWinrt::Disconnect(), so this does not keep the link open
// after an intentional disconnect.
session.MaintainConnection(true);
}
else
{
Expand Down
Loading