mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
return lock
This commit is contained in:
parent
5ca19879b6
commit
3218db5815
3 changed files with 13 additions and 6 deletions
|
@ -46,7 +46,7 @@ public record TxResp(long Confirmations, long? Height, decimal BalanceChange, Da
|
|||
//methods available on the hub in the server
|
||||
public interface IBTCPayAppHubServer
|
||||
{
|
||||
Task IdentifierActive(string group, bool active);
|
||||
Task<bool> IdentifierActive(string group, bool active);
|
||||
|
||||
Task<Dictionary<string,string>> Pair(PairRequest request);
|
||||
Task<AppHandshakeResponse> Handshake(AppHandshake request);
|
||||
|
|
|
@ -300,9 +300,10 @@ var resultPsbt = PSBT.Parse(psbt, explorerClient.Network.NBitcoinNetwork);
|
|||
}
|
||||
|
||||
|
||||
public async Task IdentifierActive(string group, bool active)
|
||||
public async Task<bool> IdentifierActive(string group, bool active)
|
||||
{
|
||||
await _appState.IdentifierActive(group, Context.ConnectionId, active);
|
||||
|
||||
return await _appState.IdentifierActive(group, Context.ConnectionId, active);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -151,6 +151,11 @@ public class BTCPayAppState : IHostedService
|
|||
{
|
||||
if (TrackedSource.TryParse(ts, out var trackedSource, ExplorerClient.Network))
|
||||
{
|
||||
if (trackedSource is GroupTrackedSource groupTrackedSource)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ExplorerClient.Track(trackedSource);
|
||||
}
|
||||
await _hubContext.Groups.AddToGroupAsync(contextConnectionId, ts);
|
||||
|
@ -193,16 +198,17 @@ public class BTCPayAppState : IHostedService
|
|||
private CancellationTokenSource _cts;
|
||||
|
||||
|
||||
public async Task IdentifierActive(string group, string contextConnectionId, bool active)
|
||||
public async Task<bool> IdentifierActive(string group, string contextConnectionId, bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
GroupToConnectionId.AddOrUpdate(group, contextConnectionId, (a, b) => contextConnectionId);
|
||||
return GroupToConnectionId.TryAdd(group, contextConnectionId);
|
||||
}
|
||||
else if (GroupToConnectionId.TryGetValue(group, out var connId) && connId == contextConnectionId)
|
||||
{
|
||||
GroupToConnectionId.TryRemove(group, out _);
|
||||
return GroupToConnectionId.TryRemove(group, out _);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task Disconnected(string contextConnectionId)
|
||||
|
|
Loading…
Add table
Reference in a new issue