Speak telnet properly to the cluster node
The old client read the socket with a StreamReader, so the option negotiation a node sends on connect landed in the text as control bytes and made a mess of the first lines. TelnetStream now answers it: it agrees to ECHO and SUPPRESS-GO-AHEAD, refuses everything else, swallows subnegotiations, and tracks what it already answered so the two ends do not reply to each other for ever. A command split across two reads is still understood, because a socket hands over whatever has turned up rather than whole messages. LineAssembler keeps the tail that has no line ending yet. Nodes write their login prompt as "login: " with nothing after it, so the old ReadLineAsync sat waiting for a line that never came and only got through because the greeting happened to mention a matching word. Login now follows N1MM: it looks for LOGON, ENTER CALL, LOG IN and the rest, and sends the callsign anyway after ten seconds if no prompt turns up. A password is sent when the node asks for one and the operator configured one. The commands go out after that, not straight after the call. A connection that has heard nothing for four minutes gets a blank line so the node does not drop it as idle. The old prompt check matched "call" anywhere in a line, which any spot comment could trigger. SendSpotAsync sends the node's dx command. Alt+P, or Edit / Spot It, spots the call being typed at the current frequency, or the last contact logged when nothing is typed, and puts it on our own bandmap without waiting for it to come back round from the node. The spot parser now takes a line with no colon after the spotter, and finds the time when DXSpider has put the spotter's grid after it. The cluster tests run over a real socket against a node fake that sends the negotiation, the prompt and spot lines. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,4 +31,39 @@ public class SpotLineTests
|
||||
Spot? spot = SpotLine.Parse("DX de W3LPL: 14025.0 DL1ABC CQ 2350Z", Now);
|
||||
Assert.Equal(new DateTime(2026, 5, 29, 23, 50, 0, DateTimeKind.Utc), spot?.AtUtc);
|
||||
}
|
||||
|
||||
/// DXSpider puts the spotter's grid after the time.
|
||||
[Fact]
|
||||
public void TheTimeIsFoundEvenWithSomethingAfterIt()
|
||||
{
|
||||
Spot? spot = SpotLine.Parse(
|
||||
"DX de OK1ABC-#: 7005.0 DL1ABC CQ 1234Z JO70",
|
||||
Now);
|
||||
|
||||
Assert.Equal(new DateTime(2026, 5, 30, 12, 34, 0, DateTimeKind.Utc), spot?.AtUtc);
|
||||
Assert.Equal("CQ", spot?.Comment);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheSpotterKeepsTheNodeSuffix() =>
|
||||
Assert.Equal("OK1ABC-#", SpotLine.Parse("DX de OK1ABC-#: 7005.0 DL1ABC CQ 1234Z", Now)?.Spotter);
|
||||
|
||||
/// Not every node writes the colon after the spotter.
|
||||
[Fact]
|
||||
public void ASpotWithNoColonAfterTheSpotterStillReads()
|
||||
{
|
||||
Spot? spot = SpotLine.Parse("DX de W3LPL 14025.0 DL1ABC CQ 1234Z", Now);
|
||||
|
||||
Assert.Equal("W3LPL", spot?.Spotter);
|
||||
Assert.Equal("DL1ABC", spot?.Call.Text);
|
||||
Assert.Equal(14_025_000, spot?.Frequency.Hertz);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ASpotWithNoTimeIsTimedOnArrival() =>
|
||||
Assert.Equal(Now, SpotLine.Parse("DX de W3LPL: 14025.0 DL1ABC CQ", Now)?.AtUtc);
|
||||
|
||||
[Fact]
|
||||
public void ALineWithNoFrequencyIsNotASpot() =>
|
||||
Assert.Null(SpotLine.Parse("DX de W3LPL: hello there", Now));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user