imageConnection: properly handle receiving R-messages with invalid tags (#205)

This commit is contained in:
samhza 2021-12-19 22:58:17 -05:00 committed by GitHub
parent 19cdfd0403
commit b2e6dd01fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ class ImageConnection {
}
const tag = msg.readUint16LE(1);
const promise = this.requests.get(tag);
if (!promise) {
logger.error(`Received response for unknown request ${tag}`);
return;
}
this.requests.delete(tag);
if (op === Rqueue) this.njobs++;
if (op === Rcancel || op === Rwait) this.njobs--;