Esempio n. 1
0
        public InMemoryConnection CreateConnection()
        {
            var transportConnection = new InMemoryTransportConnection(_memoryPool, Context.Log, Context.Scheduler);

            _transportFactory.AddConnection(transportConnection);
            return(new InMemoryConnection(transportConnection));
        }
Esempio n. 2
0
        public InMemoryConnection CreateConnection()
        {
            var transportConnection = new InMemoryTransportConnection(_memoryPool, Context.Log);

            _ = HandleConnection(transportConnection);
            return(new InMemoryConnection(transportConnection));
        }
Esempio n. 3
0
        private async Task HandleConnection(InMemoryTransportConnection transportConnection)
        {
            try
            {
                var middlewareTask = _transportFactory.ConnectionDispatcher.OnConnection(transportConnection);
                var transportTask  = CancellationTokenAsTask(transportConnection.ConnectionClosed);

                await transportTask;
                await middlewareTask;

                transportConnection.Dispose();
            }
            catch (Exception ex)
            {
                Debug.Assert(false, $"Unexpected exception: {ex}.");
            }
        }
Esempio n. 4
0
 public InMemoryConnection(InMemoryTransportConnection transportConnection)
     : base(new RawStream(transportConnection.Output, transportConnection.Input))
 {
     TransportConnection = transportConnection;
 }
 public InMemoryConnection(InMemoryTransportConnection transportConnection, Encoding encoding)
     : base(new DuplexPipeStream(transportConnection.Output, transportConnection.Input), encoding)
 {
     TransportConnection = transportConnection;
 }