Skip to content

Commit ece1cc0

Browse files
committed
Add guard to unregistering twice
1 parent d3bbac0 commit ece1cc0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

LiveControlGateway/Controllers/HubControllerBase.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,17 @@ protected override async Task<bool> TryRegisterConnection()
141141
return await _hubLifetimeManager.TryAddDeviceConnection(5, this, LinkedToken);
142142
}
143143

144+
private bool _unregistered;
145+
144146
/// <summary>
145147
/// When the connection is destroyed
146148
/// </summary>
147149
protected override async Task UnregisterConnection()
148150
{
151+
if (_unregistered)
152+
return;
153+
_unregistered = true;
154+
149155
await _hubLifetimeManager.RemoveDeviceConnection(this);
150156
}
151157

0 commit comments

Comments
 (0)