major bug fixes

This commit is contained in:
Forrest 2026-08-04 19:29:58 -04:00
parent 9728906556
commit d6144c4483
39 changed files with 483 additions and 53 deletions

View file

@ -159,6 +159,38 @@ void main() {
expect(host.clientCount, 0);
});
test('a dropped session retries instead of detaching (bug-fixes #5)',
() async {
final session = newSession(host.port!);
await connectAuthed(session);
// Watch for the *next* time we fall back to connecting (i.e. a retry) and
// assert no terminal status slips through before it — a drop after a good
// connection must be healed, never surfaced as error/disconnected.
final retrying = session.status.firstWhere((s) {
expect(s, isNot(RemoteConnStatus.error));
expect(s, isNot(RemoteConnStatus.disconnected));
expect(s, isNot(RemoteConnStatus.denied));
return s == RemoteConnStatus.connecting;
});
// Kill the connection from under the client.
await host.stop();
await retrying;
expect(session.currentStatus, RemoteConnStatus.connecting);
});
test('a device that never answers gives up (bug-fixes #5)', () async {
// Point at a port with nothing listening: cold dials fail, and after the
// capped cold-retry budget the session goes terminal so the controller can
// fall back to local playback rather than spin forever.
final session = newSession(host.port! + 1);
final failed =
session.status.firstWhere((s) => s == RemoteConnStatus.error);
await session.connect();
await failed;
});
test('a host broadcast reaches every connected remote', () async {
final a = newSession(host.port!);
final b = newSession(host.port!);