示例#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;
        }
示例#2
0
 public ServerRequest(TcpSocket socket)
     : base(socket)
 {
     this.Url = string.Empty;
 }
示例#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
            }
        }
示例#4
0
 protected virtual void OnConnection(TcpSocket socket)
 {
     this.Connection.TryInvoke(socket);
 }
示例#5
0
 public ClientResponse(TcpSocket socket)
     : base(socket)
 {
 }