1
0
mirror of https://github.com/oliverbooth/TcpDotNet synced 2024-11-09 23:25:42 +00:00

fix: read handshake response explicitly

This commit is contained in:
Oliver Booth 2024-02-13 00:31:19 +00:00
parent bf7f14acac
commit 19c83b14a1
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -95,8 +95,9 @@ public sealed class ProtocolClient : ClientNode
State = ClientState.Handshaking;
var handshakeRequest = new HandshakeRequestPacket(ProtocolVersion);
var handshakeResponse = await SendAndReceiveAsync<HandshakeResponsePacket>(handshakeRequest, cancellationToken);
await SendPacketAsync(handshakeRequest, cancellationToken);
var handshakeResponse = await WaitForPacketAsync<HandshakeResponsePacket>(cancellationToken);
if (handshakeResponse.HandshakeResponse != HandshakeResponse.Success)
{
Close();