public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize)
        {
            OSHttpRequestPump[] pumps = new OSHttpRequestPump[poolSize];
            for (int i = 0; i < pumps.Length; i++)
            {
                pumps[i] = new OSHttpRequestPump(server, queue, i);
            }

            return(pumps);
        }
Esempio n. 2
0
        /// <summary>
        /// Instantiate an HTTPS server.
        /// </summary>
        public OSHttpServer(IPAddress address, int port, X509Certificate certificate, int poolSize)
        {
            _engineId = String.Format("OSHttpServer [HTTPS:{0}/ps:{1}]", port, poolSize);
            _isSecure = true;
            _log.DebugFormat("[{0}] HTTPS server instantiated", EngineID);

            _listener = new HttpListener(address, port, certificate);
            _queue    = new OSHttpRequestQueue();
            _pumps    = OSHttpRequestPump.Pumps(this, _queue, poolSize);
        }
Esempio n. 3
0
        /// <summary>
        /// Instantiate an HTTP server.
        /// </summary>
        public OSHttpServer(IPAddress address, int port, int poolSize)
        {
            _engineId = String.Format("OSHttpServer (HTTP:{0})", port);
            _isSecure = false;
            _log.DebugFormat("[{0}] HTTP server instantiated", EngineID);

            _listener = new HttpListener(address, port);
            _queue    = new OSHttpRequestQueue();
            _pumps    = OSHttpRequestPump.Pumps(this, _queue, poolSize);
        }
        public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id)
        {
            _server = server;
            _queue  = queue;
            _id     = id;

            _engine              = new Thread(new ThreadStart(Engine));
            _engine.Name         = EngineID;
            _engine.IsBackground = true;
            _engine.Start();

            ThreadTracker.Add(_engine);
        }