internal HttpListenerContext(HttpConnection cnc, ILogger logger)
 {
     this.cnc = cnc;
     _logger = logger;
     request = new HttpListenerRequest(this);
     response = new HttpListenerResponse(this, _logger);
 }
Ejemplo n.º 2
0
        void Cleanup(bool close_existing)
        {
            lock (registry)
            {
                if (close_existing)
                {
                    // Need to copy this since closing will call UnregisterContext
                    ICollection keys = registry.Keys;
                    var all = new HttpListenerContext[keys.Count];
                    keys.CopyTo(all, 0);
                    registry.Clear();
                    for (int i = all.Length - 1; i >= 0; i--)
                        all[i].Connection.Close(true);
                }

                lock (connections.SyncRoot)
                {
                    ICollection keys = connections.Keys;
                    var conns = new HttpConnection[keys.Count];
                    keys.CopyTo(conns, 0);
                    connections.Clear();
                    for (int i = conns.Length - 1; i >= 0; i--)
                        conns[i].Close(true);
                }
            }
        }
Ejemplo n.º 3
0
 internal void RemoveConnection(HttpConnection cnc)
 {
     connections.Remove(cnc);
 }
Ejemplo n.º 4
0
 internal void AddConnection(HttpConnection cnc)
 {
     connections[cnc] = cnc;
 }
Ejemplo n.º 5
0
 internal void AddConnection(HttpConnection cnc)
 {
     connections[cnc] = cnc;
 }
Ejemplo n.º 6
0
        private static void OnRead(IAsyncResult ares)
        {
            HttpConnection cnc = (HttpConnection)ares.AsyncState;

            cnc.OnReadInternal(ares);
        }