fix(galaxy): unify IsConnected with _connected guard; AttachForTests marks connected (review)
This commit is contained in:
@@ -40,8 +40,12 @@ public sealed class GalaxyMxSession : IAsyncDisposable
|
||||
_logger = logger ?? NullLogger.Instance;
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the session is connected.</summary>
|
||||
public bool IsConnected => _session is not null;
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a session is currently established. Set <c>true</c> on a
|
||||
/// successful connect/attach and <c>false</c> after teardown/dispose — tracks the same
|
||||
/// <c>_connected</c> flag that <see cref="ConnectAsync"/> guards on, so the two never disagree.
|
||||
/// </summary>
|
||||
public bool IsConnected => _connected;
|
||||
|
||||
/// <summary>
|
||||
/// Server-side handle returned by MXAccess <c>Register</c>. Zero before
|
||||
@@ -122,6 +126,7 @@ public sealed class GalaxyMxSession : IAsyncDisposable
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
_session = session ?? throw new ArgumentNullException(nameof(session));
|
||||
_serverHandle = serverHandle;
|
||||
_connected = true; // an attached session means connected — keeps IsConnected + the ConnectAsync no-op guard consistent.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user