Fix the crash on changing network settings, and apply resynced contacts in batches
ApplyNetworkSettings disposed the station link without clearing it, so ApplyStationLinkSettings disposed it a second time and threw. Only the second function touches the link now, and StationLink.Dispose can be called twice. Contacts from the network are queued and applied together on the window thread. Each one used to rescore the whole log and redraw the log window, which kept the window thread busy for minutes during a resync. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,23 @@ public class NetworkedContactsTests
|
||||
Assert.Equal(1, session.Rescore(Start.AddMinutes(60)));
|
||||
}
|
||||
|
||||
/// A resync sends its contacts in a burst, and they are scored together.
|
||||
[Fact]
|
||||
public void ABurstOfContactsIsLoggedOnceAndRaisesOneChange()
|
||||
{
|
||||
(ContestSession session, FakeLogStore store) = Station();
|
||||
int changes = 0;
|
||||
session.Changed += (_, _) => changes++;
|
||||
|
||||
int added = session.AddRangeFromNetwork(
|
||||
[Arriving("JA1XYZ", 1), Arriving("JA2XYZ", 2), Arriving("JA1XYZ", 1)]);
|
||||
|
||||
Assert.Equal(2, added);
|
||||
Assert.Equal(1, changes);
|
||||
Assert.Equal(2, store.Qsos(session.Instance.ContestNumber).Count);
|
||||
Assert.Equal(2, session.Log.Qsos.Count);
|
||||
}
|
||||
|
||||
/// A resync drops the block it is about to be sent again, so the contacts
|
||||
/// are replaced rather than added to.
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user