mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-26 05:26:37 +10:00
fix(tcp): cancel pending connects on disconnect and propagate remote close
This commit is contained in:
@@ -22,9 +22,6 @@ class MeshCoreTcpManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> disconnect() async {
|
Future<void> disconnect() async {
|
||||||
if (!_service.isConnected && _service.activeEndpoint == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_debugLog?.info('TcpManager.disconnect', tag: 'TCP');
|
_debugLog?.info('TcpManager.disconnect', tag: 'TCP');
|
||||||
await _service.disconnect();
|
await _service.disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,11 @@ class TcpTransportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _handleSocketDone() {
|
void _handleSocketDone() {
|
||||||
|
if (_status == TcpTransportStatus.disconnecting ||
|
||||||
|
_status == TcpTransportStatus.disconnected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_addFrameError(StateError('TCP socket closed by remote endpoint'));
|
||||||
unawaited(disconnect());
|
unawaited(disconnect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user