Skip to content

Commit

Permalink
Merge pull request realitymod#2 from dingus221/patch-2
Browse files Browse the repository at this point in the history
_clientsClear function update
  • Loading branch information
Zulan committed Mar 26, 2015
2 parents 3d07d0d + 1b4a30d commit ed884be
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions PRMasterServer/Servers/ServerNatNeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,43 @@ internal class ServerNatNeg
private byte[] _socketReceivedBuffer;
private ConcurrentDictionary<int, NatNegClient> _Clients = new ConcurrentDictionary<int,NatNegClient>();

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<string, string> log, Action<string, string> logError)
{
Expand Down

0 comments on commit ed884be

Please sign in to comment.