mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-29 17:01:37 +00:00
fix: reject connections when not running (#1146)
When the node is shutting down, new connections can still be received. If this happens we can end up writing into the datastore when it's been closed which throws an error. Instead, if we're not running, have the connection manager close new incoming connections.
This commit is contained in:
@ -403,6 +403,7 @@ describe('libp2p.upgrader', () => {
|
||||
connEncryption: [Crypto]
|
||||
}
|
||||
})
|
||||
await libp2p.start()
|
||||
const echoHandler = () => {}
|
||||
libp2p.handle(['/echo/1.0.0'], echoHandler)
|
||||
|
||||
@ -448,6 +449,8 @@ describe('libp2p.upgrader', () => {
|
||||
connectionGater
|
||||
})
|
||||
|
||||
await libp2p.start()
|
||||
|
||||
const { inbound, outbound } = mockMultiaddrConnPair({ addrs, remotePeer })
|
||||
|
||||
// Spy on emit for easy verification
|
||||
|
Reference in New Issue
Block a user