Пример #1
0
        public Connection(ListenerContext context, UvStreamHandle socket) : base(context)
        {
            _socket           = socket;
            socket.Connection = this;
            ConnectionControl = this;

            ConnectionId = GenerateConnectionId(Interlocked.Increment(ref _lastConnectionId));

            if (ServerOptions.Limits.MaxRequestBufferSize.HasValue)
            {
                _bufferSizeControl = new BufferSizeControl(ServerOptions.Limits.MaxRequestBufferSize.Value, this, Thread);
            }

            SocketInput  = new SocketInput(Thread.Memory, ThreadPool, _bufferSizeControl);
            SocketOutput = new SocketOutput(Thread, _socket, this, ConnectionId, Log, ThreadPool);

            var tcpHandle = _socket as UvTcpHandle;

            if (tcpHandle != null)
            {
                RemoteEndPoint = tcpHandle.GetPeerIPEndPoint();
                LocalEndPoint  = tcpHandle.GetSockIPEndPoint();
            }

            _frame         = FrameFactory(this);
            _lastTimestamp = Thread.Loop.Now();
        }
 public ListenerContext(ListenerContext listenerContext)
     : base(listenerContext)
 {
     ServerAddress     = listenerContext.ServerAddress;
     Thread            = listenerContext.Thread;
     Memory            = listenerContext.Memory;
     ConnectionManager = listenerContext.ConnectionManager;
     WriteReqPool      = listenerContext.WriteReqPool;
     Log = listenerContext.Log;
 }
        public Connection(ListenerContext context, UvStreamHandle socket) : base(context)
        {
            _socket           = socket;
            socket.Connection = this;
            ConnectionControl = this;

            ConnectionId = GenerateConnectionId(Interlocked.Increment(ref _lastConnectionId));

            if (ServerOptions.MaxRequestBufferSize.HasValue)
            {
                _bufferSizeControl = new BufferSizeControl(ServerOptions.MaxRequestBufferSize.Value, this, Thread);
            }

            _rawSocketInput  = new SocketInput(Memory, ThreadPool, _bufferSizeControl);
            _rawSocketOutput = new SocketOutput(Thread, _socket, Memory, this, ConnectionId, Log, ThreadPool, WriteReqPool);
        }
Пример #4
0
 public ConnectionContext(ListenerContext context) : base(context)
 {
 }
Пример #5
0
 public ConnectionContext(ListenerContext context)
 {
     ListenerContext = context;
 }