mirror of https://codeberg.org/pzp/pzp-sync.git
improve logic when an RPC connect is detected
This commit is contained in:
parent
af5ac3435d
commit
403fcefc3a
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue