protected virtual void InitializePersistentState() { _hostShutdownToken = _context.Environment.GetShutdownToken(); _requestLifeTime = new HttpRequestLifeTime(this, WriteQueue, Trace, ConnectionId); // Create the TCS that completes when the task returned by PersistentConnection.OnConnected does. _connectTcs = new TaskCompletionSource <object>(); // Create a token that represents the end of this connection's life _connectionEndTokenSource = new SafeCancellationTokenSource(); _connectionEndToken = _connectionEndTokenSource.Token; // Handle the shutdown token's callback so we can end our token if it trips _hostRegistration = _hostShutdownToken.SafeRegister(state => { ((SafeCancellationTokenSource)state).Cancel(); }, _connectionEndTokenSource); // When the connection ends release the request _connectionEndRegistration = CancellationToken.SafeRegister(state => { ((HttpRequestLifeTime)state).Complete(); }, _requestLifeTime); }
protected virtual void InitializePersistentState() { _hostShutdownToken = _context.HostShutdownToken(); _requestLifeTime = new HttpRequestLifeTime(WriteQueue, Trace, ConnectionId); // Create a token that represents the end of this connection's life _connectionEndTokenSource = new SafeCancellationTokenSource(); _connectionEndToken = _connectionEndTokenSource.Token; // Handle the shutdown token's callback so we can end our token if it trips _hostRegistration = _hostShutdownToken.SafeRegister(state => { ((SafeCancellationTokenSource)state).Cancel(); }, _connectionEndTokenSource); // When the connection ends release the request _connectionEndRegistration = CancellationToken.SafeRegister(state => { ((HttpRequestLifeTime)state).Complete(); }, _requestLifeTime); }
public RequestLifetime(LongPollingTransport transport, HttpRequestLifeTime requestLifeTime, IDisposable registration) { _transport = transport; _registration = registration; _requestLifeTime = requestLifeTime; }
protected virtual Task InitializePersistentState() { _hostShutdownToken = _context.Environment.GetShutdownToken(); _requestLifeTime = new HttpRequestLifeTime(this, WriteQueue, Trace, ConnectionId); // Create the TCS that completes when the task returned by PersistentConnection.OnConnected does. _connectTcs = new TaskCompletionSource<object>(); // Create a token that represents the end of this connection's life _connectionEndTokenSource = new SafeCancellationTokenSource(); _connectionEndToken = _connectionEndTokenSource.Token; // Handle the shutdown token's callback so we can end our token if it trips _hostRegistration = _hostShutdownToken.SafeRegister(state => { ((SafeCancellationTokenSource)state).Cancel(); }, _connectionEndTokenSource); // When the connection ends release the request _connectionEndRegistration = CancellationToken.SafeRegister(state => { ((HttpRequestLifeTime)state).Complete(); }, _requestLifeTime); return InitializeMessageId(); }
public RequestLifetime(ForeverTransport transport, HttpRequestLifeTime lifetime) { _lifetime = lifetime; _transport = transport; }
public RequestLifetime(ForeverTransport transport, HttpRequestLifeTime lifetime) { _lifetime = lifetime; _transport = transport; }
public RequestLifetime(LongPollingTransport transport, HttpRequestLifeTime requestLifeTime, IDisposable registration) { _transport = transport; _registration = registration; _requestLifeTime = requestLifeTime; }
protected virtual void InitializePersistentState() { _hostShutdownToken = _context.HostShutdownToken(); _requestLifeTime = new HttpRequestLifeTime(WriteQueue, Trace, ConnectionId); // Create a token that represents the end of this connection's life _connectionEndTokenSource = new SafeCancellationTokenSource(); _connectionEndToken = _connectionEndTokenSource.Token; // Handle the shutdown token's callback so we can end our token if it trips _hostRegistration = _hostShutdownToken.SafeRegister(state => { ((SafeCancellationTokenSource)state).Cancel(); }, _connectionEndTokenSource); // When the connection ends release the request _connectionEndRegistration = CancellationToken.SafeRegister(state => { ((HttpRequestLifeTime)state).Complete(); }, _requestLifeTime); }