From 19c83b14a153e51f6c666ddf3451c881e05cb3e5 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 13 Feb 2024 00:31:19 +0000 Subject: [PATCH] fix: read handshake response explicitly --- TcpDotNet/ProtocolClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs index d6a32bc..98547d5 100644 --- a/TcpDotNet/ProtocolClient.cs +++ b/TcpDotNet/ProtocolClient.cs @@ -95,8 +95,9 @@ public sealed class ProtocolClient : ClientNode State = ClientState.Handshaking; var handshakeRequest = new HandshakeRequestPacket(ProtocolVersion); - var handshakeResponse = await SendAndReceiveAsync(handshakeRequest, cancellationToken); + await SendPacketAsync(handshakeRequest, cancellationToken); + var handshakeResponse = await WaitForPacketAsync(cancellationToken); if (handshakeResponse.HandshakeResponse != HandshakeResponse.Success) { Close();