mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fix weave bug for payloads that exceed the maximum write length
PiperOrigin-RevId: 563185164
This commit is contained in:
committed by
Copybara-Service
parent
8725391822
commit
197d3f8476
@@ -32,9 +32,7 @@ objc_library(
|
||||
deps = [
|
||||
":Shared",
|
||||
"//third_party/apple_frameworks:CoreBluetooth",
|
||||
"//third_party/apple_frameworks:CoreFoundation",
|
||||
"//third_party/apple_frameworks:Foundation",
|
||||
"//third_party/apple_frameworks:QuartzCore",
|
||||
"//third_party/objective_c/google_toolbox_for_mac:GTM_Logger",
|
||||
],
|
||||
)
|
||||
|
||||
+5
-1
@@ -728,7 +728,11 @@ static NSString *PeripheralStateString(CBPeripheralState state) {
|
||||
packet.version);
|
||||
[_connectionConfirmTimer invalidate];
|
||||
_connectionConfirmTimer = nil;
|
||||
_socket.packetSize = packet.packetSize;
|
||||
// Weave is using `CBCharacteristicWriteWithResponse` for writes, so we must query max value since
|
||||
// it can have a smaller value than the `GNSWeaveConnectionConfirmPacket` size.
|
||||
NSUInteger maxWriteLength =
|
||||
[_socket.peerAsPeripheral maximumWriteValueLengthForType:CBCharacteristicWriteWithResponse];
|
||||
_socket.packetSize = MIN(packet.packetSize, maxWriteLength);
|
||||
[_socket didConnect];
|
||||
if (packet.data) {
|
||||
// According to the Weave BLE protocol the data received during the connection handshake should
|
||||
|
||||
Reference in New Issue
Block a user