示例#1
0
 public void Open()
 {
     BufferPool.BUFFER_SIZE   = AgentBufferSize;
     BufferPool.POOL_MAX_SIZE = AgentBufferPoolSize;
     HttpServer[GATEWAY_TAG]  = this;
     HttpServer.ModuleManager.AssemblyLoding += (o, e) =>
     {
         LoadPlugin(e.Assembly);
     };
     if (HttpServer.Options.CacheLogMaxSize < 1000)
     {
         HttpServer.Options.CacheLogMaxSize = 1000;
     }
     if (HttpServer.Options.BufferPoolMaxMemory < 1024)
     {
         HttpServer.Options.BufferPoolMaxMemory = 1024;
     }
     if (HttpServer.Options.BufferSize < 1024 * 8)
     {
         HttpServer.Options.BufferSize = 1024 * 8;
     }
     mIOQueue = new BeetleX.Dispatchs.DispatchCenter <Tuple <UrlRouteAgent, HttpRequest, HttpResponse> >(OnRouteExecute,
                                                                                                         ThreadQueues);
     HttpServer.Options.UrlIgnoreCase = false;
     // HttpServer.Options.IOQueueEnabled = true;
     HttpServer.Open();
     HttpServer.HttpRequesting += OnRequest;
     LoadConfig();
     //GatewayController controller = new GatewayController(this);
     //HttpServer.ActionFactory.Register(controller);
     PluginCenter.Load(typeof(Gateway).Assembly);
     HttpServer.Log(BeetleX.EventArgs.LogType.Info, $"Gateway server started [v:{this.GetType().Assembly.GetName().Version}]");
     mVerifyTimer = new Timer(OnVerifyTimer, null, 1000, 1000);
 }
示例#2
0
        public void Open()
        {
            HttpServer[GATEWAY_TAG] = this;
            HttpServer.ModuleManager.AssemblyLoding += (o, e) =>
            {
                LoadPlugin(e.Assembly);
            };
            if (HttpServer.Options.CacheLogMaxSize < 1000)
            {
                HttpServer.Options.CacheLogMaxSize = 1000;
            }
            mIOQueue = new BeetleX.Dispatchs.DispatchCenter <Tuple <UrlRouteAgent, HttpRequest, HttpResponse> >(OnRouteExecute,
                                                                                                                ThreadQueues);
            HttpServer.Options.UrlIgnoreCase = false;
            HttpServer.Options.AgentRewrite  = true;
            HttpServer.Open();
            HttpServer.HttpRequesting += OnRequest;
            LoadConfig();

            PluginCenter.Load(typeof(Gateway).Assembly);
            HttpServer.Log(BeetleX.EventArgs.LogType.Info, $"Gateway server started [v:{this.GetType().Assembly.GetName().Version}]");
            mVerifyTimer = new Timer(OnVerifyTimer, null, 1000, 1000);
        }
示例#3
0
        public void Open()
        {
            HttpServer[GATEWAY_TAG] = this;
            HttpServer.ModuleManager.AssemblyLoding += (o, e) =>
            {
                LoadPlugin(e.Assembly);
            };
            if (HttpServer.Options.CacheLogMaxSize < 1000)
            {
                HttpServer.Options.CacheLogMaxSize = 1000;
            }
            mIOQueue = new BeetleX.Dispatchs.DispatchCenter <Tuple <UrlRouteAgent, HttpRequest, HttpResponse> >(OnRouteExecute,
                                                                                                                ThreadQueues);
            // HttpServer.Options.UrlIgnoreCase = false;
            if (HttpServer.Options.MaxWaitQueue > 0 && HttpServer.Options.MaxWaitQueue < 500)
            {
                HttpServer.Options.MaxWaitQueue = 1000;
            }
            HttpServer.Options.AgentRewrite = true;
            HttpServer.FrameSerializer      = new WSAgents.WSAgentDataFrameSerializer();
            if (WSEnabled)
            {
                HttpServer.WebSocketReceive = OnWebsocketReceive;
            }
            HttpServer.WriteLogo = OutputLogo;
            HttpServer.Open();
            HttpServer.HttpRequesting += OnHttpRequest;
            HttpServer.HttpDisconnect += OnHttpDisconnect;
            LoadConfig();
            HeaderTypeFactory.SERVAR_HEADER_BYTES = Encoding.ASCII.GetBytes("Server :" + GATEWAY_VERSION + "\r\n");
            PluginCenter.Load(typeof(Gateway).Assembly);

            mVerifyTimer = new Timer(OnVerifyTimer, null, 1000, 1000);

            ProxyBufferPool = new BufferPool(BufferSize, BufferPool.POOL_SIZE, PoolMaxSize);
        }