Fix backpressure

This commit is contained in:
Daniel Huigens
2018-06-13 15:18:27 +02:00
parent 589b666ac7
commit 304cbf4783
4 changed files with 160 additions and 72 deletions

View File

@@ -267,8 +267,8 @@ function dearmor(input) {
}
}));
data = stream.transformPair(data, async (readable, writable) => {
const checksumVerified = getCheckSum(stream.clone(readable));
stream.pipe(readable, writable, {
const checksumVerified = getCheckSum(stream.passiveClone(readable));
await stream.pipe(readable, writable, {
preventClose: true
});
const checksumVerifiedString = await stream.readToEnd(checksumVerified);
@@ -306,7 +306,7 @@ function armor(messagetype, body, partindex, parttotal, customComment) {
hash = body.hash;
body = body.data;
}
const bodyClone = stream.clone(body);
const bodyClone = stream.passiveClone(body);
const result = [];
switch (messagetype) {
case enums.armor.multipart_section: