File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.3.1
2
+
3
+ - fix: correctly handle situation where a socket has been closed but the other
4
+ side is still writing to it
5
+
1
6
## 2.3.0
2
7
3
8
- feat: Add ` authTimeout ` property to SocketConnector. Previously this was
4
- - hard-coded to 5 seconds which is a bit restrictive for slow network
9
+ hard-coded to 5 seconds which is a bit restrictive for slow network
5
10
connections. It now defaults to 30 seconds but may be set at time of
6
11
construction
7
12
- feat: added ` authTimeout ` parameter to ` serverToServer ` ; this is provided
Original file line number Diff line number Diff line change @@ -141,9 +141,17 @@ class SocketConnector {
141
141
StreamController <Uint8List > sc = StreamController <Uint8List >();
142
142
side.farSide! .sink = sc;
143
143
Stream <List <int >> transformed = side.transformer !(sc.stream);
144
- transformed.listen (side.farSide! .socket.add);
144
+ transformed.listen ((event) {
145
+ try {
146
+ side.farSide! .socket.add (event);
147
+ } catch (e) {
148
+ _log ('Failed to write to side ${side .farSide !.name } - closing' ,
149
+ force: true );
150
+ _destroySide (side.farSide! );
151
+ }
152
+ });
145
153
}
146
- side.stream.listen ((Uint8List data) async {
154
+ side.stream.listen ((Uint8List data) {
147
155
if (logTraffic) {
148
156
final message = String .fromCharCodes (data);
149
157
if (side.isSideA) {
@@ -154,7 +162,13 @@ class SocketConnector {
154
162
'B -> A : ${message .replaceAll (RegExp ('[\x 00-\x 1F\x 7F-\x FF]' ), '*' )}' ));
155
163
}
156
164
}
157
- side.farSide! .sink.add (data);
165
+ try {
166
+ side.farSide! .sink.add (data);
167
+ } catch (e) {
168
+ _log ('Failed to write to side ${side .farSide !.name } - closing' ,
169
+ force: true );
170
+ _destroySide (side.farSide! );
171
+ }
158
172
}, onDone: () {
159
173
_log ('stream.onDone on side ${side .name }' );
160
174
_destroySide (side);
Original file line number Diff line number Diff line change 1
1
name : socket_connector
2
2
description : Package for joining sockets together to create socket relays.
3
3
4
- version : 2.3.0
4
+ version : 2.3.1
5
5
repository : https://github.com/cconstab/socket_connector
6
6
7
7
environment :
You can’t perform that action at this time.
0 commit comments