mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-21 18:55:17 +00:00
Always update client's name on connect
Since the client variable would be changed in a reconnect, the name is not set on the old client object.
This commit is contained in:
parent
db05586dd0
commit
66114bdecb
1 changed files with 2 additions and 2 deletions
|
@ -170,7 +170,6 @@ public class Server {
|
|||
ConnectPacket connect = new ConnectPacket();
|
||||
connect.Deserialize(memory.Memory.Span[packetRange]);
|
||||
lock (Clients) {
|
||||
client.Name = connect.ClientName;
|
||||
if (Clients.Count(x => x.Connected) == Settings.Instance.Server.MaxPlayers) {
|
||||
client.Logger.Error($"Turned away as server is at max clients");
|
||||
memory.Dispose();
|
||||
|
@ -212,6 +211,7 @@ public class Server {
|
|||
throw new Exception($"Invalid connection type {connect.ConnectionType}");
|
||||
}
|
||||
|
||||
client.Name = connect.ClientName;
|
||||
client.Connected = true;
|
||||
if (firstConn) {
|
||||
// do any cleanup required when it comes to new clients
|
||||
|
@ -313,4 +313,4 @@ public class Server {
|
|||
header.Deserialize(data[..Constants.HeaderSize]);
|
||||
return header;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue