@@ -235,7 +235,7 @@ private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connecti
235
235
}
236
236
237
237
// Mark the connection as active
238
- connection . ChangeState ( from : HttpConnectionStatus . Inactive , to : HttpConnectionStatus . Active ) ;
238
+ connection . TryChangeState ( from : HttpConnectionStatus . Inactive , to : HttpConnectionStatus . Active ) ;
239
239
240
240
// Raise OnConnected for new connections only since polls happen all the time
241
241
if ( connection . ApplicationTask == null )
@@ -333,7 +333,7 @@ private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connecti
333
333
334
334
// This is done outside a lock because the next poll might be waiting in the lock already and waiting for currentRequestTcs to complete
335
335
// A DELETE request could have set the status to Disposed. If that is the case we don't want to change the state ever.
336
- connection . ChangeState ( from : HttpConnectionStatus . Active , to : HttpConnectionStatus . Inactive ) ;
336
+ connection . TryChangeState ( from : HttpConnectionStatus . Active , to : HttpConnectionStatus . Inactive ) ;
337
337
}
338
338
}
339
339
finally
@@ -373,7 +373,7 @@ private async Task DoPersistentConnection(ConnectionDelegate connectionDelegate,
373
373
}
374
374
375
375
// Mark the connection as active
376
- connection . ChangeState ( HttpConnectionStatus . Inactive , HttpConnectionStatus . Active ) ;
376
+ connection . TryChangeState ( HttpConnectionStatus . Inactive , HttpConnectionStatus . Active ) ;
377
377
378
378
// Call into the end point passing the connection
379
379
connection . ApplicationTask = ExecuteApplication ( connectionDelegate , connection ) ;
0 commit comments