Fix freezing on VM shutdown

This commit is contained in:
MDMCK10
2023-02-11 18:52:45 +01:00
parent e7b56d18e6
commit 87cefdaaba
2 changed files with 18 additions and 1 deletions

View File

@@ -65,7 +65,20 @@ export default class QMPClient extends EventEmitter {
}
if (msg.return !== undefined)
this.emit("qmpreturn", msg.return);
else
else if(msg.event !== undefined) {
switch(msg.event) {
case "POWERDOWN":
case "STOP":
{
this.emit("qmpshutdown");
break
};
default: {
this.emit("qmpreturn", '');
break;
}
}
}else
// for now just return an empty string.
// This is a giant hack but avoids a deadlock
this.emit("qmpreturn", '');