Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public async Task <Socket> ConnectToHostAsync(Uri uri)
 {
     return(await ServerHandler.ConnectToHostAsync(uri).WithoutCapturingContext());
 }