From ade3e5d292c888d5a1492f1580b694870eafab59 Mon Sep 17 00:00:00 2001 From: Matthew Endsley Date: Wed, 3 Feb 2021 01:14:36 -0800 Subject: [PATCH] Initialize the keep-alive timer before sending packets --- Hazel/Udp/UnityUdpClientConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Hazel/Udp/UnityUdpClientConnection.cs b/Hazel/Udp/UnityUdpClientConnection.cs index 19256ab..eb9264b 100644 --- a/Hazel/Udp/UnityUdpClientConnection.cs +++ b/Hazel/Udp/UnityUdpClientConnection.cs @@ -135,14 +135,14 @@ namespace Hazel.Udp throw new HazelException("A SocketException occurred while initiating a receive operation.", e); } + this.InitializeKeepAliveTimer(); + // Write bytes to the server to tell it hi (and to punch a hole in our NAT, if present) // When acknowledged set the state to connected SendHello(bytes, () => { this.State = ConnectionState.Connected; }); - - this.InitializeKeepAliveTimer(); } /// -- 2.39.5