player can shoot bullet (crashes game when leaving map)
This commit is contained in:
parent
dd6b0fffc1
commit
b10ccf2da8
1 changed files with 230 additions and 98 deletions
|
|
@ -74,21 +74,20 @@ internal sealed class ClientScreenServer(
|
|||
|
||||
public async Task SendAsync(DisplayPixelBuffer buf)
|
||||
{
|
||||
if (await _wantedFrames.WaitAsync(TimeSpan.Zero))
|
||||
{
|
||||
_logger.LogTrace("sending");
|
||||
try
|
||||
{
|
||||
await _channel.Writer.WriteAsync(buf.Data);
|
||||
}
|
||||
catch (ChannelClosedException)
|
||||
{
|
||||
_logger.LogWarning("send failed, channel is closed");
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!await _wantedFrames.WaitAsync(TimeSpan.Zero))
|
||||
{
|
||||
_logger.LogTrace("client does not want a frame yet");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogTrace("sending");
|
||||
try
|
||||
{
|
||||
await _channel.Writer.WriteAsync(buf.Data);
|
||||
}
|
||||
catch (ChannelClosedException)
|
||||
{
|
||||
_logger.LogWarning("send failed, channel is closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue