You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
3 years ago
|
using System;
|
||
|
|
||
|
namespace ET
|
||
|
{
|
||
|
[Timer(TimerType.SessionAcceptTimeout)]
|
||
|
public class SessionAcceptTimeout: ATimer<SessionAcceptTimeoutComponent>
|
||
|
{
|
||
|
public override void Run(SessionAcceptTimeoutComponent self)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
self.Parent.Dispose();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
Log.Error($"move timer error: {self.Id}\n{e}");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ObjectSystem]
|
||
|
public class SessionAcceptTimeoutComponentAwakeSystem: AwakeSystem<SessionAcceptTimeoutComponent>
|
||
|
{
|
||
|
public override void Awake(SessionAcceptTimeoutComponent self)
|
||
|
{
|
||
|
self.Timer = TimerComponent.Instance.NewOnceTimer(TimeHelper.ServerNow() + 5000, TimerType.SessionAcceptTimeout, self);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[ObjectSystem]
|
||
|
public class SessionAcceptTimeoutComponentDestroySystem: DestroySystem<SessionAcceptTimeoutComponent>
|
||
|
{
|
||
|
public override void Destroy(SessionAcceptTimeoutComponent self)
|
||
|
{
|
||
|
TimerComponent.Instance.Remove(ref self.Timer);
|
||
|
}
|
||
|
}
|
||
|
}
|