diff --git a/src/ArtemisNetCoreClient/Connection.cs b/src/ArtemisNetCoreClient/Connection.cs index 5859636..73bb13d 100644 --- a/src/ArtemisNetCoreClient/Connection.cs +++ b/src/ArtemisNetCoreClient/Connection.cs @@ -16,7 +16,7 @@ internal class Connection : IConnection, IChannel private readonly Endpoint _endpoint; private readonly Task _receiveLoopTask; private readonly ConcurrentDictionary _channels = new(); - private readonly ConcurrentDictionary> _completionSources = new(); + private readonly ConcurrentDictionary> _completionSources = new(); private readonly SemaphoreSlim _lock = new(1, 1); private readonly IdGenerator _sessionChannelIdGenerator = new(10); private readonly CancellationTokenSource _receiveLoopCancellationToken; @@ -78,7 +78,7 @@ public void OnPacket(in InboundPacket packet) var createSessionResponseMessage = new CreateSessionResponseMessage(packet.Payload); if (_completionSources.TryRemove(-1, out var tcs)) { - tcs.TrySetResult(createSessionResponseMessage); + tcs.TrySetResult(new SessionInfo { ServerVersion = createSessionResponseMessage.ServerVersion }); } break; default: @@ -109,10 +109,10 @@ public async Task CreateSessionAsync(CancellationToken cancellationTok try { await _lock.WaitAsync(cancellationToken); - var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); _ = _completionSources.TryAdd(-1, tcs); Send(createSessionMessage, 1); - var incomingPacket = (CreateSessionResponseMessage) await tcs.Task; + var incomingPacket = (SessionInfo) await tcs.Task; var session = new Session(this, _loggerFactory) { diff --git a/src/ArtemisNetCoreClient/SessionInfo.cs b/src/ArtemisNetCoreClient/SessionInfo.cs new file mode 100644 index 0000000..d7eb801 --- /dev/null +++ b/src/ArtemisNetCoreClient/SessionInfo.cs @@ -0,0 +1,6 @@ +namespace ActiveMQ.Artemis.Core.Client; + +internal class SessionInfo +{ + public required int ServerVersion { get; init; } +} \ No newline at end of file