@magicred-1/react-native-lxmf 0.2.38 → 0.2.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -272,8 +272,13 @@ class BleManager(
272
272
  if (characteristic.uuid == RNS_RX_CHAR_UUID && value != null && value.isNotEmpty()) {
273
273
  if (preparedWrite) {
274
274
  // ATT Long Write fragment — buffer until onExecuteWrite.
275
- preparedWriteBuffer.getOrPut(device.address) { java.io.ByteArrayOutputStream() }
276
- .write(value)
275
+ val buf = preparedWriteBuffer.getOrPut(device.address) { java.io.ByteArrayOutputStream() }
276
+ if (buf.size() + value.size <= 65536) {
277
+ buf.write(value)
278
+ } else {
279
+ Log.w(TAG, "ATT Long Write buffer cap (64 KiB) exceeded from ${device.address}, discarding fragment")
280
+ preparedWriteBuffer.remove(device.address)
281
+ }
277
282
  } else {
278
283
  Log.d(TAG, "GATT server RX ${value.size}B from ${device.address}")
279
284
  module.nativeBleReceive(macToBytes(device.address), value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicred-1/react-native-lxmf",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "description": "LXMF Reticulum mesh networking for React Native + Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",