From ccffa2f92562c5038a90a94ad7d45fbb02c97339 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Mon, 16 Sep 2024 16:41:01 +0200 Subject: [PATCH 1/2] Fix potential outgoing message corruption in managed websockets --- Realm/Realm/Native/SyncSocketProvider.WebSocket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Realm/Realm/Native/SyncSocketProvider.WebSocket.cs b/Realm/Realm/Native/SyncSocketProvider.WebSocket.cs index 5aa91cc811..522a1e7a35 100644 --- a/Realm/Realm/Native/SyncSocketProvider.WebSocket.cs +++ b/Realm/Realm/Native/SyncSocketProvider.WebSocket.cs @@ -124,7 +124,7 @@ public async void Write(BinaryValue data, IntPtr native_callback) try { - await _webSocket.SendAsync(new(buffer), WebSocketMessageType.Binary, true, _cancellationToken); + await _webSocket.SendAsync(new(buffer, 0, (int)data.size), WebSocketMessageType.Binary, true, _cancellationToken); } catch (Exception e) { From 1822f410bffa8cf9d523d27ad3f435cdcb316119 Mon Sep 17 00:00:00 2001 From: Yavor Georgiev Date: Mon, 16 Sep 2024 17:20:25 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b55485ee09..c7996b45b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * None ### Fixed -* None +* Fixed a possible disruption of sync traffic under heavy load when using managed web sockets where malformed binary messages cause the server to drop the connection and force the client to reconnect and upload again. (Issue [#3671](https://github.com/realm/realm-dotnet/issues/3671)). ### Compatibility * Realm Studio: 15.0.0 or later.