mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 01:01:23 +00:00
fix: catch error in upgrader close call
This commit is contained in:
@ -271,10 +271,15 @@ class Upgrader {
|
||||
if (connection && args[1] === 'close' && args[2] && !_timeline.close) {
|
||||
// Wait for close to finish before notifying of the closure
|
||||
(async () => {
|
||||
if (connection.stat.status === ConnectionStatus.OPEN) {
|
||||
await connection.close()
|
||||
try {
|
||||
if (connection.stat.status === ConnectionStatus.OPEN) {
|
||||
await connection.close()
|
||||
}
|
||||
} catch (err) {
|
||||
log.error(err)
|
||||
} finally {
|
||||
this.onConnectionEnd(connection)
|
||||
}
|
||||
this.onConnectionEnd(connection)
|
||||
})()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user