Chats now only try to connect, if they are opened

This commit is contained in:
Patrick Hellebrand
2021-09-23 12:53:57 +02:00
parent 3a90f26262
commit 924676bee6
3 changed files with 20 additions and 7 deletions

View File

@@ -146,9 +146,11 @@ namespace PolyChat
private bool isInConnections(string IP)
{
if (Connections.ContainsKey(IP))
return true;
return false;
return Connections.ContainsKey(IP);
}
public bool IsConnected(string ip)
{
return Connections.ContainsKey(ip) && Connections[ip].IsConnected();
}
public static string getIP()
@@ -195,7 +197,6 @@ namespace PolyChat
ip = ip.Substring(0, ip.Length - 4);
Debug.WriteLine($"-{ip}");
Debug.WriteLine(jsonArr);
Connect(ip);
UIController.OnIncomingConnection(ip);
UIController.OnIncomingMessages(ip, jsonArr);
}