in src/firefox/rdp-client.js [153:178]
_flushPendingRequests() {
this._pending = this._pending.filter(({ request, deferred }) => {
if (this._active.has(request.to)) {
// Keep in the pending requests until there are no requests
// active on the target RDP actor.
return true;
}
const conn = this._rdpConnection;
if (!conn) {
throw new Error('RDP connection closed');
}
try {
let str = JSON.stringify(request);
str = `${Buffer.from(str).length}:${str}`;
conn.write(str);
this._expectReply(request.to, deferred);
} catch (err) {
deferred.reject(err);
}
// Remove the pending request from the queue.
return false;
});
}