DisconnectHelper.cs 511 B

123456789101112131415161718192021222324
  1. namespace ET.Server
  2. {
  3. public static class DisconnectHelper
  4. {
  5. public static async ETTask Disconnect(this Session self)
  6. {
  7. if (self == null || self.IsDisposed)
  8. {
  9. return;
  10. }
  11. long instanceId = self.InstanceId;
  12. await TimerComponent.Instance.WaitAsync(1000);
  13. if (self.InstanceId != instanceId)
  14. {
  15. return;
  16. }
  17. self.Dispose();
  18. }
  19. }
  20. }