-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reset dial queue shut down controller on node restart
When a node is stopped and started we need to reset the dial queue shutdown controller otherwise every dial attempt after a restart will be rejected as the shutdown controller signal is still aborted. Fixes #2188
- Loading branch information
1 parent
c003789
commit fe32aab
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { multiaddr } from '@multiformats/multiaddr' | ||
import { createLibp2p } from 'libp2p' | ||
import { createBaseOptions } from './fixtures/base-options.js' | ||
import type { Libp2p } from '@libp2p/interface' | ||
|
||
describe('lifecycle', () => { | ||
let peer: Libp2p | ||
|
||
afterEach(async () => { | ||
await peer?.stop() | ||
}) | ||
|
||
it('can dial a node after restarting', async () => { | ||
const ma = multiaddr(process.env.RELAY_MULTIADDR) | ||
|
||
peer = await createLibp2p(createBaseOptions()) | ||
|
||
await peer.dial(ma) | ||
|
||
// stop and restart peer | ||
await peer.stop() | ||
await peer.start() | ||
|
||
// once started, attempt to dial again | ||
await peer.dial(ma) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters