mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-18 19:51: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) {
|
if (connection && args[1] === 'close' && args[2] && !_timeline.close) {
|
||||||
// Wait for close to finish before notifying of the closure
|
// Wait for close to finish before notifying of the closure
|
||||||
(async () => {
|
(async () => {
|
||||||
|
try {
|
||||||
if (connection.stat.status === ConnectionStatus.OPEN) {
|
if (connection.stat.status === ConnectionStatus.OPEN) {
|
||||||
await connection.close()
|
await connection.close()
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
log.error(err)
|
||||||
|
} finally {
|
||||||
this.onConnectionEnd(connection)
|
this.onConnectionEnd(connection)
|
||||||
|
}
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user