@@ -1056,6 +1056,7 @@ class NodeManager {
10561056 await this . nodeConnectionManager . createConnectionMultiple (
10571057 [ nodeId ] ,
10581058 addresses ,
1059+ ctx ,
10591060 ) ;
10601061 return [
10611062 [ nodeConnection . host , nodeConnection . port ] ,
@@ -1109,9 +1110,12 @@ class NodeManager {
11091110 } ) ( ) ;
11101111 const closestNodesRequestP = ( async ( ) => {
11111112 const resultStream =
1112- await conn . rpcClient . methods . nodesClosestLocalNodesGet ( {
1113- nodeIdEncoded : nodeIdEncoded ,
1114- } ) ;
1113+ await conn . rpcClient . methods . nodesClosestLocalNodesGet (
1114+ {
1115+ nodeIdEncoded : nodeIdEncoded ,
1116+ } ,
1117+ ctx ,
1118+ ) ;
11151119 for await ( const { nodeIdEncoded, nodeContact } of resultStream ) {
11161120 const nodeId = nodesUtils . decodeNodeId ( nodeIdEncoded ) ;
11171121 if ( nodeId == null ) {
@@ -1676,7 +1680,7 @@ class NodeManager {
16761680 // fails we delete the old node and add in the new one.
16771681 const [ bucketIndex ] = this . nodeGraph . bucketIndex ( nodeId ) ;
16781682 // To avoid conflict we want to lock on the bucket index
1679- await this . nodeGraph . lockBucket ( bucketIndex , tran ) ;
1683+ await this . nodeGraph . lockBucket ( bucketIndex , tran , ctx ) ;
16801684
16811685 const nodeContact = await this . nodeGraph . getNodeContact ( nodeId , tran ) ;
16821686 // If this is a new entry, check the bucket limit
@@ -1816,7 +1820,7 @@ class NodeManager {
18161820 if ( pendingNodes == null || pendingNodes . size === 0 ) return ;
18171821 this . pendingNodes . set ( bucketIndex , new Map ( ) ) ;
18181822 // Locking on bucket
1819- await this . nodeGraph . lockBucket ( bucketIndex , tran ) ;
1823+ await this . nodeGraph . lockBucket ( bucketIndex , tran , ctx ) ;
18201824 const semaphore = new Semaphore ( this . concurrencyLimit ) ;
18211825 // Iterating over existing nodes
18221826 const bucket = await this . nodeGraph . getBucket (
@@ -1832,9 +1836,9 @@ class NodeManager {
18321836 const pendingPromises : Array < Promise < void > > = [ ] ;
18331837 for ( const [ nodeId ] of bucket ) {
18341838 if ( removedNodes >= pendingNodes . size ) break ;
1835- await semaphore . waitForUnlock ( ) ;
1839+ await semaphore . waitForUnlock ( ctx ) ;
18361840 if ( ctx . signal ?. aborted === true ) break ;
1837- const [ semaphoreReleaser ] = await semaphore . lock ( ) ( ) ;
1841+ const [ semaphoreReleaser ] = await semaphore . lock ( ctx ) ( ) ;
18381842 pendingPromises . push (
18391843 ( async ( ) => {
18401844 // Ping and remove or update node in bucket
@@ -1853,15 +1857,15 @@ class NodeManager {
18531857 false ,
18541858 false ,
18551859 undefined ,
1856- undefined ,
1860+ ctx ,
18571861 tran ,
18581862 ) ;
18591863 } else {
18601864 // We don't remove node the ping was aborted
18611865 if ( ctx . signal . aborted ) return ;
18621866 // We need to lock this since it's concurrent
18631867 // and shares the transaction
1864- await unsetLock . withF ( async ( ) => {
1868+ await unsetLock . withF ( ctx , async ( ) => {
18651869 await this . unsetNode ( nodeId , tran ) ;
18661870 removedNodes += 1 ;
18671871 } ) ;
@@ -1887,7 +1891,7 @@ class NodeManager {
18871891 false ,
18881892 false ,
18891893 undefined ,
1890- undefined ,
1894+ ctx ,
18911895 tran ,
18921896 ) ;
18931897 removedNodes -= 1 ;
0 commit comments