IService.cs 623 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Threading.Tasks;
  3. using Common.Base;
  4. using MongoDB.Bson;
  5. namespace Common.Network
  6. {
  7. public enum NetworkProtocol
  8. {
  9. TCP,
  10. UDP,
  11. }
  12. public interface IService: IDisposable
  13. {
  14. /// <summary>
  15. /// 将函数调用加入IService线程
  16. /// </summary>
  17. /// <param name="action"></param>
  18. void Add(Action action);
  19. AChannel GetChannel(ObjectId id);
  20. AChannel GetChannel(string host, int port);
  21. AChannel GetChannel(string address);
  22. Task<AChannel> GetChannel();
  23. void Remove(AChannel channel);
  24. void Update();
  25. TimerManager Timer { get; }
  26. }
  27. }