Ejemplo n.º 1
0
        protected IncomingMessage(TcpSocket socket)
        {
            this.Connection = socket;

            this.HttpVersion = null;
            this.Headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            this.Trailers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            this.Readable = true;

            this.Method = null;
        }
Ejemplo n.º 2
0
 public ServerRequest(TcpSocket socket)
     : base(socket)
 {
     this.Url = string.Empty;
 }
Ejemplo n.º 3
0
        private void AcceptConnectionsTask()
        {
            while (!_tasksHandler.IsCancellationRequested)
            {
                Socket incoming;
                try
                {
                    incoming = this._socket.Accept();
                }
                catch(SocketException)
                {
                    if (this._socket == null) //we got disposed
                    {
                        OnClosed();
                        return;
                    }

                    throw;
                }

                if (this.IsPaused)
                {
                    //incoming.Disconnect(false);
                    //incoming.Close();
                    //incoming.Dispose();
                    incoming.Shutdown(SocketShutdown.Both);

                    _unpauseEvent.Wait();
                    _unpauseEvent.Reset(); //next wait will block
                    continue;
                }

                var socket = new TcpSocket(incoming);
                lock (_sockets)
                {
                    this._sockets.Add(socket);
                }

                this.OnConnection(socket);
                Thread.Sleep(0); //allow any ThreadInterruptedExceptions to bubble
            }
        }
Ejemplo n.º 4
0
 protected virtual void OnConnection(TcpSocket socket)
 {
     this.Connection.TryInvoke(socket);
 }
Ejemplo n.º 5
0
 public ClientResponse(TcpSocket socket)
     : base(socket)
 {
 }