예제 #1
0
 public Session(Connection clientConnection, BufferAllocator bufferAllocator)
 {
     _clientConnection = clientConnection;
     _bufferAllocator  = bufferAllocator;
     _request          = new Request(this);
     _response         = new Response(this);
     _clientHandler    = new ClientHandler(this, _clientConnection);
     _serverHandler    = new ServerHandler(this);
 }
예제 #2
0
 internal Session(Pipe clientPipe, Pipe serverPipe, HttpProxy proxy)
 {
     Id            = Guid.NewGuid();
     ClientPipe    = clientPipe;
     ClientHandler = new ClientHandler(this);
     ServerPipe    = serverPipe;
     ServerHandler = new ServerHandler(this);
     Flags         = new SessionFlag();
     CurrentState  = State.ReceivingHeaders;
     Proxy         = proxy;
 }
예제 #3
0
        internal async Task <Pipe> EnsureConnectedToServerAsync(Uri uri)
        {
            if (ServerPipe == null)
            {
                var socket = await ConnectToHostAsync(uri).WithoutCapturingContext();

                ServerPipe    = new Pipe(new NetworkStream(socket));
                ServerHandler = new ServerHandler(this);
            }
            return(ServerPipe);
        }
예제 #4
0
 public async Task <Socket> ConnectToHostAsync(Uri uri)
 {
     return(await ServerHandler.ConnectToHostAsync(uri).WithoutCapturingContext());
 }