Connected no longer depends on socket

This commit is contained in:
Sanae 2022-02-09 15:56:57 -06:00
parent 94a29aca12
commit 6759f80bc5
2 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@ namespace Server;
public class Client : IDisposable {
public Socket? Socket;
public bool Connected => Socket?.Connected ?? false;
public bool Connected = false;
public Guid Id;
public CostumePacket CurrentCostume = new CostumePacket {
BodyName = "",

View File

@ -121,6 +121,8 @@ public class Server {
default:
throw new Exception($"Invalid connection type {connect.ConnectionType}");
}
client.Connected = true;
if (firstConn) {
// do any cleanup required when it comes to new clients
List<Client> toDisconnect = Clients.FindAll(c => c.Id == header.Id && c.Connected && c.Socket != null);