From 1b4a30d0f4b7253d19a32d05a8e6a9e6ac7343b7 Mon Sep 17 00:00:00 2001 From: Bruce Wayne Date: Thu, 26 Mar 2015 08:47:31 +0400 Subject: [PATCH] _clientsClear function update --- PRMasterServer/Servers/ServerNatNeg.cs | 47 ++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/PRMasterServer/Servers/ServerNatNeg.cs b/PRMasterServer/Servers/ServerNatNeg.cs index 34f3496..a1a974e 100644 --- a/PRMasterServer/Servers/ServerNatNeg.cs +++ b/PRMasterServer/Servers/ServerNatNeg.cs @@ -31,16 +31,43 @@ internal class ServerNatNeg private byte[] _socketReceivedBuffer; private ConcurrentDictionary _Clients = new ConcurrentDictionary(); - public void clientsClear() - { - Log(Category, "ClientsClearFunction"); - foreach (var display in _Clients) - { - Log(Category, "id: " + display.Value.ClientId.ToString() + "; host: " + display.Value.Host.ToString() + "; guest: " + display.Value.Guest.ToString()); - } - Log(Category, "ClientsClearFunction - END"); - _Clients.Clear(); - } + public static void _clientsClear(bool clear1) + { + Program.Log("ClientsClearFunction(+show)"); + foreach (var display in _Clients) + { + string cid = display.Value.ClientId.ToString(); + string h1 = "null";string h2 = "null"; + string g1 = "null";string g2 = "null"; + if (display.Value.Host != null) + { + if (display.Value.Host.PublicAddress != null) + { + h1 = display.Value.Host.PublicAddress.ToString(); + } + if (display.Value.Host.CommunicationAddress != null) + { + h2 = display.Value.Host.CommunicationAddress.ToString(); + } + } + if (display.Value.Guest != null) + { + if (display.Value.Guest.PublicAddress !=null) + { + display.Value.Guest.PublicAddress.ToString(); + } + if (display.Value.Guest.CommunicationAddress != null) + { + g2 = display.Value.Guest.CommunicationAddress.ToString(); + } + } + Program.LogControl("id:"+cid); + Program.LogControl("h1:" + h1 + ";h2:" + h2); + Program.LogControl("g1:" + g1 + ";g2:" + g2); + } + Program.LogBlue("Count:"+_Clients.Count.ToString()); + if (clear1 == true){_Clients.Clear();} + } public ServerNatNeg(IPAddress listen, ushort port, Action log, Action logError) {