Message ID | d2b704d336eb2ba5b1650492e23af35d7c42661e.1274516288.git.jan.kiszka@web.de |
---|---|
State | New |
Headers | show |
diff --git a/QMP/qmp.py b/QMP/qmp.py index d9da603..4062f84 100644 --- a/QMP/qmp.py +++ b/QMP/qmp.py @@ -63,10 +63,14 @@ class QEMUMonitorProtocol: def __json_read(self): try: - return json.loads(self.sock.recv(1024)) + while True: + line = json.loads(self.sockfile.readline()) + if not 'event' in line: + return line except ValueError: return def __init__(self, filename): self.filename = filename self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + self.sockfile = self.sock.makefile()