improve logic when an RPC connect is detected

This commit is contained in:
Andre Staltz 2023-07-13 11:15:16 +03:00
parent af5ac3435d
commit 403fcefc3a
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 4 additions and 3 deletions

View File

@ -47,19 +47,20 @@ module.exports = {
if (!iamClient) return
const local = toPull.duplex(createStream(rpc.id, true))
let abort
const remote = rpc.tangleSync.connect((networkError) => {
if (networkError && getSeverity(networkError) >= 3) {
if (isMuxrpcMissingError(networkError, 'tangleSync', 'connect')) {
console.warn(`peer ${rpc.id} does not support sync connect`)
debug('peer %s does not support tangleSync', rpc.id)
// } else if (isReconnectedError(networkError)) { // TODO: bring back
// Do nothing, this is a harmless error
} else {
console.error(`rpc.tangleSync.connect exception:`, networkError)
}
abort?.(true, () => {})
}
})
pull(local, remote, local)
abort = pull(local, remote, local)
})
function connect() {