mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-22 03:05:16 +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();
|
ConnectPacket connect = new ConnectPacket();
|
||||||
connect.Deserialize(memory.Memory.Span[packetRange]);
|
connect.Deserialize(memory.Memory.Span[packetRange]);
|
||||||
lock (Clients) {
|
lock (Clients) {
|
||||||
client.Name = connect.ClientName;
|
|
||||||
if (Clients.Count(x => x.Connected) == Settings.Instance.Server.MaxPlayers) {
|
if (Clients.Count(x => x.Connected) == Settings.Instance.Server.MaxPlayers) {
|
||||||
client.Logger.Error($"Turned away as server is at max clients");
|
client.Logger.Error($"Turned away as server is at max clients");
|
||||||
memory.Dispose();
|
memory.Dispose();
|
||||||
|
@ -212,6 +211,7 @@ public class Server {
|
||||||
throw new Exception($"Invalid connection type {connect.ConnectionType}");
|
throw new Exception($"Invalid connection type {connect.ConnectionType}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.Name = connect.ClientName;
|
||||||
client.Connected = true;
|
client.Connected = true;
|
||||||
if (firstConn) {
|
if (firstConn) {
|
||||||
// do any cleanup required when it comes to new clients
|
// do any cleanup required when it comes to new clients
|
||||||
|
@ -313,4 +313,4 @@ public class Server {
|
||||||
header.Deserialize(data[..Constants.HeaderSize]);
|
header.Deserialize(data[..Constants.HeaderSize]);
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue