예제 #1
0
        private async Task ExecuteApplication(ConnectionDelegate connectionDelegate, HttpConnectionContext connection)
        {
            // Verify some initialization invariants
            Debug.Assert(connection.TransportType != HttpTransportType.None, "Transport has not been initialized yet");

            // Jump onto the thread pool thread so blocking user code doesn't block the setup of the
            // connection and transport
            await AwaitableThreadPool.Yield();

            // Running this in an async method turns sync exceptions into async ones
            await connectionDelegate(connection);
        }
예제 #2
0
        private async Task ExecuteApplication(ConnectionDelegate connectionDelegate, HttpConnectionContext connection)
        {
            // Verify some initialization invariants
            // We want to be positive that the IConnectionInherentKeepAliveFeature is initialized before invoking the application, if the long polling transport is in use.
            Debug.Assert(connection.TransportType != HttpTransportType.None, "Transport has not been initialized yet");
            Debug.Assert(connection.TransportType != HttpTransportType.LongPolling ||
                         connection.Features.Get <IConnectionInherentKeepAliveFeature>() != null, "Long-polling transport is in use but IConnectionInherentKeepAliveFeature as not configured");

            // Jump onto the thread pool thread so blocking user code doesn't block the setup of the
            // connection and transport
            await AwaitableThreadPool.Yield();

            // Running this in an async method turns sync exceptions into async ones
            await connectionDelegate(connection);
        }