diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-02-20 15:33:27 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-03-07 16:50:04 +0100 |
commit | 5b774fe5505dc7daad908f9f4b95e9e735c45c14 (patch) | |
tree | 068be487b96ffe6dfb076f22a9a30120aaea5ab4 /chardev/char-socket.c | |
parent | 3a75ef6a0fe397b0d36930415be6b123750a6afe (diff) | |
download | qemu-5b774fe5505dc7daad908f9f4b95e9e735c45c14.zip qemu-5b774fe5505dc7daad908f9f4b95e9e735c45c14.tar.gz qemu-5b774fe5505dc7daad908f9f4b95e9e735c45c14.tar.bz2 |
chardev-socket: do not blindly reset handlers when switching GMainContext
If the socket is connecting or connected, tcp_chr_update_read_handler will
be called but it should not set the NetListener's callbacks again.
Otherwise, tcp_chr_accept is invoked while the socket is in connected
state and you get an assertion failure.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'chardev/char-socket.c')
-rw-r--r-- | chardev/char-socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 4fcdd8a..6d287ba 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -632,7 +632,7 @@ static void tcp_chr_update_read_handler(Chardev *chr) { SocketChardev *s = SOCKET_CHARDEV(chr); - if (s->listener) { + if (s->listener && s->state == TCP_CHARDEV_STATE_DISCONNECTED) { /* * It's possible that chardev context is changed in * qemu_chr_be_update_read_handlers(). Reset it for QIO net |