From ccc7ea5b257b14e1800791a79aa5becfdafebd7d Mon Sep 17 00:00:00 2001 From: Malloc of Kuzkycyziklistan Date: Wed, 6 Sep 2017 23:26:58 -0500 Subject: [PATCH] p p --- server/Socks/MasterUdpClient.cs | 11 ++++++----- server/Socks/MasterUdpServer.cs | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/Socks/MasterUdpClient.cs b/server/Socks/MasterUdpClient.cs index 7ee0e42..3e60a89 100644 --- a/server/Socks/MasterUdpClient.cs +++ b/server/Socks/MasterUdpClient.cs @@ -79,11 +79,12 @@ namespace SockScape { } } - if(LastMessageIn.Ticks == 0 && DeltaLastOut.TotalSeconds > 10) - Send(new Packet(kIntraSlaveId.InitiationAttempt, Configuration.General["Master Secret"])); - else { - - } + if (LastMessageIn.Ticks != 0) { + if(DeltaLastOut.TotalSeconds > 2) + Send(new Packet()); + } else + if(DeltaLastOut.TotalSeconds > 10) + Send(new Packet(kIntraSlaveId.InitiationAttempt, Configuration.General["Master Secret"])); Thread.Sleep(1); } diff --git a/server/Socks/MasterUdpServer.cs b/server/Socks/MasterUdpServer.cs index 961a735..73fb09c 100644 --- a/server/Socks/MasterUdpServer.cs +++ b/server/Socks/MasterUdpServer.cs @@ -51,7 +51,8 @@ namespace SockScape { if(packet == null) continue; - + + Clients[client].LastReceive = DateTime.Now; switch((kIntraSlaveId)packet.Id) { case kIntraSlaveId.InitiationAttempt: if(packet.RegionCount != 1 || IsProspectConnected(client)) @@ -155,6 +156,7 @@ namespace SockScape { class Client { public IPEndPoint Address { get; set; } public DateTime LastReceive { get; set; } + public TimeSpan ReceiveDelta => DateTime.Now - LastReceive; public Cipher Encryptor { get; set; } public Key Key { get; set; } }