Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(@libp2p/tcp): close listener during upgrade #2767

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/transport-tcp/test/listen-dial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,29 @@ describe('dial', () => {
await listener.close()
})

it('dial and close listener during upgrade', async () => {
const ma = multiaddr('/ip6/::/tcp/9090')

const listener = transport.createListener({
upgrader: {
...upgrader,
async upgradeInbound () {
return new Promise(() => {})
}
}
})

await listener.listen(ma)
const addrs = listener.getAddrs()
await transport.dial(addrs[0], {
// can also be triggered with a upgradeOutbound that does not resolve
// if the listeners upgrader is waiting
upgrader
})

await listener.close()
})

it('dials on IPv4 with IPFS Id', async () => {
const ma = multiaddr('/ip4/127.0.0.1/tcp/9090/ipfs/Qmb6owHp6eaWArVbcJJbQSyifyJBttMMjYV76N2hMbf5Vw')
const listener = transport.createListener({
Expand Down
Loading