python/qemu/qmp.py: Fix settimeout operation
commit39cf73c3494045b4418c9c1db8e803640e2150dc
authorJohn Snow <jsnow@redhat.com>
Fri, 9 Oct 2020 17:51:23 +0000 (9 13:51 -0400)
committerJohn Snow <jsnow@redhat.com>
Tue, 20 Oct 2020 19:00:06 +0000 (20 15:00 -0400)
treea87dddc8e040a7819cafe109983c38ed02fc00df
parentd5cca076c3a1ac55f25792fae4fae2b0b1f71e8e
python/qemu/qmp.py: Fix settimeout operation

We enabled callers to interface directly with settimeout, but this
reacts poorly with blocking/nonblocking operation; as they are using the
same internal mechanism.

1. Whenever we change the blocking mechanism temporarily, always set it
back to what it was afterwards.

2. Disallow callers from setting a timeout of "0", which means
Non-blocking mode. This is going to create more weird problems than
anybody wants, so just forbid it.

I opt not to coerce '0' to 'None' to maintain the principal of least
surprise in mirroring the semantics of Python's interface.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20201009175123.249009-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
python/qemu/qmp.py