From f42981c14da7de085b5d18f74474bf35124b0889 Mon Sep 17 00:00:00 2001 From: gkc Date: Tue, 12 Nov 2024 15:10:06 +0000 Subject: [PATCH] fix: re-added call to flush() --- lib/src/socket_connector.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/socket_connector.dart b/lib/src/socket_connector.dart index 0f6f629..1d486e6 100644 --- a/lib/src/socket_connector.dart +++ b/lib/src/socket_connector.dart @@ -141,9 +141,10 @@ class SocketConnector { StreamController sc = StreamController(); side.farSide!.sink = sc; Stream> transformed = side.transformer!(sc.stream); - transformed.listen((event) { + transformed.listen((event) async { try { side.farSide!.socket.add(event); + await side.farSide!.socket.flush(); } catch (e) { _log('Failed to write to side ${side.farSide!.name} - closing', force: true); @@ -151,7 +152,7 @@ class SocketConnector { } }); } - side.stream.listen((Uint8List data) { + side.stream.listen((Uint8List data) async { if (logTraffic) { final message = String.fromCharCodes(data); if (side.isSideA) { @@ -164,6 +165,7 @@ class SocketConnector { } try { side.farSide!.sink.add(data); + await side.farSide!.socket.flush(); } catch (e) { _log('Failed to write to side ${side.farSide!.name} - closing', force: true);