modernuo/Projects/Server/Network/Packets/OutgoingPackets.cs
2023-02-07 21:22:04 -08:00

13 lines
575 B
C#

using System.Runtime.CompilerServices;
namespace Server.Network;
public static class OutgoingPackets
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool CannotSendPackets(this NetState ns) =>
// Do not check for NetState.Running. Packets are sent to a "disconnected" socket as part of the OnDisconnect events
// up until the Connection is nulled. Closing the connection is done synchronously, therefore packets will not be sent
// once the Mobile.NetState is null.
ns?.Connection == null || ns.BlockAllPackets;
}