fix: make socket calls sync (#2363)

cyan committed Jul 9, 2025 at 04:18 UTC 37ed413a72cdc770f7d4bda574f22a16af22306d
4 files changed +8 -8
cw_core/lib/utils/proxy_socket/abstract.dart
+2 -2
@@ -40,8 +40,8 @@ abstract class ProxySocket {
40 }
41
42 Future<void> close();
43 - Future<void> destroy();
44 - Future<void> write(String data);
43 + void destroy();
44 + void write(String data);
45 StreamSubscription<List<int>> listen(Function(Uint8List event) onData, {Function (Object error)? onError, Function ()? onDone, bool cancelOnError = true});
46 ProxyAddress get address;
47 }
\ No newline at end of file
cw_core/lib/utils/proxy_socket/insecure.dart
+2 -2
@@ -15,10 +15,10 @@ class ProxySocketInsecure implements ProxySocket {
15 Future<void> close() => socket.close();
16
17 @override
18 - Future<void> destroy() async => socket.destroy();
18 + void destroy() => socket.destroy();
19
20 @override
21 - Future<void> write(String data) async => socket.write(data);
21 + void write(String data) => socket.write(data);
22
23 @override
24 StreamSubscription<List<int>> listen(Function(Uint8List event) onData, {Function(Object error)? onError, Function()? onDone, bool cancelOnError = true}) {
cw_core/lib/utils/proxy_socket/secure.dart
+2 -2
@@ -15,10 +15,10 @@ class ProxySocketSecure implements ProxySocket {
15 Future<void> close() => socket.close();
16
17 @override
18 - Future<void> destroy() async => socket.destroy();
18 + void destroy() => socket.destroy();
19
20 @override
21 - Future<void> write(String data) async => socket.write(data);
21 + void write(String data) => socket.write(data);
22
23 @override
24 StreamSubscription<List<int>> listen(Function(Uint8List event) onData, {Function(Object error)? onError, Function()? onDone, bool cancelOnError = true}) {
cw_core/lib/utils/proxy_socket/socks.dart
+2 -2
@@ -16,10 +16,10 @@ class ProxySocketSocks implements ProxySocket {
16 Future<void> close() => socket.close();
17
18 @override
19 - Future<void> destroy() => close();
19 + void destroy() => close();
20
21 @override
22 - Future<void> write(String data) async => socket.write(data);
22 + void write(String data) => socket.write(data);
23
24 @override
25 StreamSubscription<List<int>> listen(Function(Uint8List event) onData, {Function(Object error)? onError, Function()? onDone, bool cancelOnError = true}) {