示例#1
0
        public RpcServer(int _backLength, int _port, bool _usessl, string _sslfile, int timeoutSec, string _sslpassword = "", ISerializer _serializer = null)
        {
            backLength            = _backLength;
            port                  = _port;
            useSSl                = _usessl;
            sslFile               = _sslfile;
            sslPassword           = _sslpassword;
            this.apiActionTable   = new ApiActionTable();
            this.PacketIdProvider = new PacketIdProvider();
            this.TaskSetterTable  = new TaskSetterTable <long>();

            this.TimeOut = TimeSpan.FromSeconds(timeoutSec);
            if (_serializer == null)
            {
                this.Serializer = new DefaultSerializer();
            }
            else
            {
                this.Serializer = _serializer;
            }
            this.GlobalFilters           = new FastGlobalFilters();
            this.DependencyResolver      = new DefaultDependencyResolver();
            this.FilterAttributeProvider = new DefaultFilterAttributeProvider();
            allSessions = new ConcurrentDictionary <string, FastSession>();
            DomainAssembly.GetAssemblies().ForEach(item => this.BindService(item));
        }
示例#2
0
 /// <summary>
 /// 初始化
 /// </summary>
 private void Init()
 {
     this.apiActionTable   = new ApiActionTable(Common.GetServiceApiActions(this.GetType()));
     this.packetIdProvider = new PacketIdProvider();
     this.taskSetterTable  = new TaskSetterTable <long>();
     this.Serializer       = new DefaultSerializer();
     this.TimeOut          = TimeSpan.FromSeconds(30);
 }
 /// <summary>
 /// 初始化
 /// </summary>
 private void Init()
 {
     this.apiActionTable   = new ApiActionTable(this.FindApiActions());
     this.packetIdProvider = new PacketIdProvider();
     this.taskSetterTable  = new TaskSetterTable <long>();
     this.TimeOut          = TimeSpan.FromSeconds(30);
     this.JsonSerializer   = new DefaultDynamicJsonSerializer();
 }
示例#4
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     this.apiActionTable = null;
     this.taskSetterTable.Clear();
     this.taskSetterTable  = null;
     this.packetIdProvider = null;
     this.Serializer       = null;
     this.clientSession.CloseSafe();
 }
示例#5
0
        /// <summary>
        /// 释放资源
        /// </summary>
        public override void Dispose()
        {
            base.Dispose();

            this.apiActionTable = null;
            this.taskSetterTable.Clear();
            this.taskSetterTable  = null;
            this.packetIdProvider = null;
            this.Serializer       = null;
        }
示例#6
0
        /// <summary>
        /// JsonWebSocket中间件
        /// </summary>
        public JsonWebSocketMiddleware()
        {
            this.apiActionTable   = new ApiActionTable();
            this.PacketIdProvider = new PacketIdProvider();
            this.TaskSetterTable  = new TaskSetterTable <long>();

            this.TimeOut                 = TimeSpan.FromSeconds(30);
            this.JsonSerializer          = new DefaultDynamicJsonSerializer();
            this.GlobalFilters           = new WebSocketGlobalFilters();
            this.DependencyResolver      = new DefaultDependencyResolver();
            this.FilterAttributeProvider = new DefaultFilterAttributeProvider();

            DomainAssembly.GetAssemblies().ForEach(item => this.BindService(item));
        }
示例#7
0
 public RpcClient(IPAddress _host, int _port, bool _usessl, string _sslfile, string _sslpassword = "", ISerializer _serializer = null)
 {
     host                  = _host;
     port                  = _port;
     useSSl                = _usessl;
     sslFile               = _sslfile;
     sslPassword           = _sslpassword;
     this.apiActionTable   = new ApiActionTable(Common.GetServiceApiActions(this.GetType()));
     this.packetIdProvider = new PacketIdProvider();
     this.taskSetterTable  = new TaskSetterTable <long>();
     if (_serializer == null)
     {
         this.Serializer = new DefaultSerializer();
     }
     else
     {
         this.Serializer = _serializer;
     }
     this.TimeOut = TimeSpan.FromSeconds(30);
 }