This commit is contained in:
Chris Langsenkamp 2019-10-07 06:41:35 -04:00
commit 98b6328f76
3 changed files with 6 additions and 2 deletions

View File

@ -99,7 +99,7 @@ void ReceiveThreadFunction(string ip, int port)
// if we got here then we are done. ReceiveLoop cleans up already,
// but we may never get there if connect fails. so let's clean up
// here too.
client.Close();
client?.Close();
}
public void Connect(string ip, int port)

View File

@ -42,7 +42,7 @@ public bool TryDequeue(out T result)
{
lock(queue)
{
result = default;
result = default(T);
if (queue.Count > 0)
{
result = queue.Dequeue();

View File

@ -230,6 +230,10 @@ public void Stop()
// clear clients list
clients.Clear();
// reset the counter in case we start up again so
// clients get connection ID's starting from 1
counter = 0;
}
// send message to client using socket connection.