mirror of https://codeberg.org/pzp/pzp-sync.git
close connect() stream on rpc closed
This commit is contained in:
parent
ae3d1d83d8
commit
6e54ca2724
|
@ -57,7 +57,7 @@ function initSync(peer, config) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {{ shse: SHSE, sync: { connect: GetDuplex } }} rpc
|
||||
* @param {{ shse: SHSE, sync: { connect: GetDuplex }, once: CallableFunction }} rpc
|
||||
* @param {boolean} iamClient
|
||||
*/
|
||||
function onSyncRPCConnect(rpc, iamClient) {
|
||||
|
@ -80,6 +80,9 @@ function initSync(peer, config) {
|
|||
}
|
||||
})
|
||||
abort = pull(local, remote, local)
|
||||
rpc.once('closed', () => {
|
||||
abort?.(true, () => {})
|
||||
})
|
||||
if (started) stream.initiate()
|
||||
}
|
||||
peer.on('rpc:connect', onSyncRPCConnect)
|
||||
|
|
Loading…
Reference in New Issue