mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Fix ServerReplay error
This commit is contained in:
1 parent
ab0858a2c9
commit
1cb7077772
3 files changed
+7
-7
No files matched your search
@@ -269,7 +269,7 @@ namespace Impostor.Server.Net
|
||||
_logger.LogError(ex, "Exception caught in client disconnection.");
|
||||
}
|
||||
|
||||
_logger.LogInformation("Client disconnecting, reason: {0}.", reason);
|
||||
_logger.LogInformation("Client {0} disconnecting, reason: {1}.", Id, reason);
|
||||
_clientManager.Remove(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api;
|
||||
using Impostor.Api.Innersloth.Data;
|
||||
using Impostor.Api.Innersloth.Net;
|
||||
using Impostor.Api.Innersloth.Net.Objects;
|
||||
@@ -246,8 +247,7 @@ namespace Impostor.Server.Net.State
|
||||
// Only the host is allowed to despawn objects.
|
||||
if (!sender.IsHost)
|
||||
{
|
||||
_logger.LogWarning("Player {0} ({1}) tried to send SpawnFlag as non-host.", sender.Client.Name, sender.Client.Id);
|
||||
return false;
|
||||
throw new ImpostorCheatException("Tried to send SpawnFlag as non-host.");
|
||||
}
|
||||
|
||||
var objectId = reader.ReadPackedUInt32();
|
||||
@@ -314,9 +314,9 @@ namespace Impostor.Server.Net.State
|
||||
break;
|
||||
}
|
||||
|
||||
// Only the host is allowed to despawn objects.
|
||||
case GameDataTag.DespawnFlag:
|
||||
{
|
||||
// Only the host is allowed to despawn objects.
|
||||
var netId = reader.ReadPackedUInt32();
|
||||
if (_allObjectsFast.TryGetValue(netId, out var obj))
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Impostor.Tools.ServerReplay
|
||||
var addressLength = reader.ReadByte();
|
||||
var addressBytes = reader.ReadBytes(addressLength);
|
||||
var addressPort = reader.ReadUInt16();
|
||||
var address = new IPEndPoint(new IPAddress(addressBytes), addressPort);
|
||||
var address = new IPEndPoint(new IPAddress(addressBytes), clientId);
|
||||
var name = reader.ReadString();
|
||||
|
||||
// Create and register connection.
|
||||
@@ -153,9 +153,9 @@ namespace Impostor.Tools.ServerReplay
|
||||
{
|
||||
GameOptions.Add(clientId, Message00HostGameC2S.Deserialize(message));
|
||||
}
|
||||
else
|
||||
else if (Connections.TryGetValue(clientId, out var client))
|
||||
{
|
||||
await Connections[clientId].Client!.HandleMessageAsync(message, messageType);
|
||||
await client.Client!.HandleMessageAsync(message, messageType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in new issue
Block a user