mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Fix leaking MessageWriters
This commit is contained in:
1 parent
2ea270d577
commit
62aa0ff832
3 files changed
+9
-7
No files matched your search
@@ -14,10 +14,12 @@ namespace Impostor.Server.Net.Inner.Objects.Components
|
||||
SnapTo(position, minSid);
|
||||
|
||||
// Broadcast to all clients.
|
||||
var writer = _game.StartRpc(NetId, RpcCalls.SnapTo);
|
||||
WriteVector2(writer, position);
|
||||
writer.Write(_lastSequenceId);
|
||||
await _game.FinishRpcAsync(writer);
|
||||
using (var writer = _game.StartRpc(NetId, RpcCalls.SnapTo))
|
||||
{
|
||||
WriteVector2(writer, position);
|
||||
writer.Write(_lastSequenceId);
|
||||
await _game.FinishRpcAsync(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace Impostor.Server.Net.Inner.Objects
|
||||
|
||||
public async ValueTask SetMurderedAsync()
|
||||
{
|
||||
var writer = _game.StartRpc(NetId, RpcCalls.MurderPlayer);
|
||||
using var writer = _game.StartRpc(NetId, RpcCalls.MurderPlayer);
|
||||
writer.Write((byte)NetId);
|
||||
await _game.FinishRpcAsync(writer);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Impostor.Server.Net.State
|
||||
{
|
||||
internal partial class Game : IGame
|
||||
internal partial class Game
|
||||
{
|
||||
private readonly ILogger<Game> _logger;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
@@ -123,4 +123,4 @@ namespace Impostor.Server.Net.State
|
||||
.Select(p => p.Client.Connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user