internal HttpListenerContext(HttpConnection cnc, ILogger logger) { this.cnc = cnc; _logger = logger; request = new HttpListenerRequest(this); response = new HttpListenerResponse(this, _logger); }
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); } } }
internal void RemoveConnection(HttpConnection cnc) { connections.Remove(cnc); }
internal void AddConnection(HttpConnection cnc) { connections[cnc] = cnc; }
internal void AddConnection(HttpConnection cnc) { connections[cnc] = cnc; }
private static void OnRead(IAsyncResult ares) { HttpConnection cnc = (HttpConnection)ares.AsyncState; cnc.OnReadInternal(ares); }