ActorLocationSender.cs 674 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections.Generic;
  2. using System.Net;
  3. using System.Threading.Tasks;
  4. namespace ETModel
  5. {
  6. // 知道对方的Id,使用这个类发actor消息
  7. public class ActorLocationSender : ComponentWithId
  8. {
  9. // actor的地址
  10. public IPEndPoint Address;
  11. public long ActorId;
  12. // 还没发送的消息
  13. public Queue<ActorTask> WaitingTasks = new Queue<ActorTask>();
  14. // 最近发送消息的时间
  15. public long LastSendTime;
  16. public int FailTimes;
  17. public const int MaxFailTimes = 5;
  18. public TaskCompletionSource<ActorTask> Tcs;
  19. public override void Dispose()
  20. {
  21. if (this.IsDisposed)
  22. {
  23. return;
  24. }
  25. base.Dispose();
  26. }
  27. }
  28. }