Skip to content

Commit c6f3611

Browse files
HandyS11claude
andcommitted
style(connections): satisfy member ordering for IsConnected
The pre-push formatter relocates the IsConnected member added with the liveness watchdog (property after the constructor / in declared order). No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 38a1b24 commit c6f3611

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/RustPlusBot.Features.Connections/Listening/RustPlusSocketSource.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ private sealed partial class RustPlusServerConnection : IRustServerConnection
154154
private readonly ILogger _logger;
155155
private readonly RustPlus _rustPlus;
156156

157-
/// <inheritdoc />
158-
// CONFIRMED (2.0.0-beta.5): RustPlusSocket.IsConnected == (_webSocket?.State == WebSocketState.Open),
159-
// so it flips to false as soon as the server closes the socket (the library raises no event for that).
160-
public bool IsConnected => _rustPlus.IsConnected;
161-
162157
public RustPlusServerConnection(string ip,
163158
int port,
164159
ulong steamId,
@@ -177,6 +172,11 @@ public RustPlusServerConnection(string ip,
177172
_rustPlus.OnClanChanged += OnClanChanged;
178173
}
179174

175+
/// <inheritdoc />
176+
// CONFIRMED (2.0.0-beta.5): RustPlusSocket.IsConnected == (_webSocket?.State == WebSocketState.Open),
177+
// so it flips to false as soon as the server closes the socket (the library raises no event for that).
178+
public bool IsConnected => _rustPlus.IsConnected;
179+
180180
public async Task<SocketConnectOutcome> ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
181181
{
182182
using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);

tests/RustPlusBot.Features.Connections.Tests/Fakes/FakeRustSocketSource.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ internal sealed class FakeConnection(SocketConnectOutcome outcome, FakeRustSocke
195195
private IReadOnlyList<MapMarkerSnapshot> _lastMarkers = [];
196196
private bool _markerScriptStarted;
197197

198-
/// <summary>Liveness flag consulted by the supervisor's watchdog. Set false to simulate a
199-
/// server-initiated socket close (which the real library signals via <c>IsConnected</c>, not an event).</summary>
200-
public bool IsConnected { get; set; } = true;
201-
202198
/// <summary>Gets the messages sent via <see cref="SendTeamMessageAsync"/>.</summary>
203199
public List<string> SentMessages { get; } = [];
204200

@@ -275,6 +271,10 @@ internal sealed class FakeConnection(SocketConnectOutcome outcome, FakeRustSocke
275271
/// <summary>Messages sent to in-game clan chat through this fake.</summary>
276272
public List<string> SentClanMessages { get; } = [];
277273

274+
/// <summary>Liveness flag consulted by the supervisor's watchdog. Set false to simulate a
275+
/// server-initiated socket close (which the real library signals via <c>IsConnected</c>, not an event).</summary>
276+
public bool IsConnected { get; set; } = true;
277+
278278
/// <summary>Raised when a team chat message arrives on this connection.</summary>
279279
public event EventHandler<TeamChatLine>? TeamMessageReceived;
280280

0 commit comments

Comments
 (0)