fix qmp hang if return is empty
This commit is contained in:
@@ -42,14 +42,14 @@ export default class QMPClient extends EventEmitter {
|
|||||||
var msg;
|
var msg;
|
||||||
try {msg = JSON.parse(msgraw);}
|
try {msg = JSON.parse(msgraw);}
|
||||||
catch {return;}
|
catch {return;}
|
||||||
if (msg.QMP) {
|
if (msg.QMP !== undefined) {
|
||||||
if (this.sentConnected) {return;};
|
if (this.sentConnected) {return;};
|
||||||
await this.execute({ execute: "qmp_capabilities" });
|
await this.execute({ execute: "qmp_capabilities" });
|
||||||
|
|
||||||
this.emit('connected');
|
this.emit('connected');
|
||||||
this.sentConnected = true;
|
this.sentConnected = true;
|
||||||
}
|
}
|
||||||
if (msg.return) this.emit("qmpreturn", msg.return);
|
if (msg.return !== undefined) this.emit("qmpreturn", msg.return);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onClose() {
|
private onClose() {
|
||||||
|
|||||||
Reference in New Issue
Block a user