mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-26 04:12:57 +10:00
fix(tcp): reset state on aborted pre-handshake connect
This commit is contained in:
@@ -61,4 +61,33 @@ void main() {
|
||||
expect(result, isFalse);
|
||||
});
|
||||
});
|
||||
|
||||
group('shouldResetStateAfterTcpConnectAbort', () {
|
||||
test('returns true when TCP connect is still in connecting state', () {
|
||||
final result = MeshCoreConnector.shouldResetStateAfterTcpConnectAbort(
|
||||
state: MeshCoreConnectionState.connecting,
|
||||
activeTransport: MeshCoreTransportType.tcp,
|
||||
);
|
||||
|
||||
expect(result, isTrue);
|
||||
});
|
||||
|
||||
test('returns false when state is already disconnected', () {
|
||||
final result = MeshCoreConnector.shouldResetStateAfterTcpConnectAbort(
|
||||
state: MeshCoreConnectionState.disconnected,
|
||||
activeTransport: MeshCoreTransportType.tcp,
|
||||
);
|
||||
|
||||
expect(result, isFalse);
|
||||
});
|
||||
|
||||
test('returns false when transport switched away from TCP', () {
|
||||
final result = MeshCoreConnector.shouldResetStateAfterTcpConnectAbort(
|
||||
state: MeshCoreConnectionState.connecting,
|
||||
activeTransport: MeshCoreTransportType.bluetooth,
|
||||
);
|
||||
|
||||
expect(result, isFalse);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user