File tree Expand file tree Collapse file tree
LiveControlGateway/Controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,14 +93,14 @@ public LiveControlController(
9393 _pingTimer . Elapsed += ( _ , _ ) => OsTask . Run ( SendPing ) ;
9494 }
9595
96-
97- private volatile bool _unregistered ;
96+
97+ private bool _unregistered ;
9898
9999 /// <inheritdoc />
100100 protected override async Task UnregisterConnection ( )
101101 {
102- if ( _unregistered ) return ;
103- _unregistered = true ;
102+ if ( Interlocked . Exchange ( ref _unregistered , true ) )
103+ return ;
104104
105105 if ( _hubLifetime == null ) return ;
106106 if ( ! await _hubLifetime . RemoveLiveControlClient ( this ) )
@@ -307,7 +307,7 @@ private async Task IntakePong(JsonDocument? _)
307307 {
308308 Logger . LogTrace ( "Intake pong" ) ;
309309
310- // Received pong without sending ping, this could be abusing the pong endpoint .
310+ // Received pong without sending ping, this could be abusing the pong endpoin>t .
311311 if ( _pingTimestamp == 0 )
312312 {
313313 // TODO: Kick or warn client.
@@ -535,6 +535,7 @@ await QueueMessage(new LiveControlResponse<LiveResponseType>
535535 [ NonAction ]
536536 public async Task HubDisconnected ( )
537537 {
538+ Interlocked . Exchange ( ref _unregistered , true ) ;
538539 _unregistered = true ; // The hub lifetime has already unregistered us
539540
540541 Logger . LogTrace ( "Hub disconnected, disposing controller" ) ;
You can’t perform that action at this time.
0 commit comments