aboutsummaryrefslogtreecommitdiff
path: root/chardev
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-02-20 15:33:27 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-07 16:50:04 +0100
commit5b774fe5505dc7daad908f9f4b95e9e735c45c14 (patch)
tree068be487b96ffe6dfb076f22a9a30120aaea5ab4 /chardev
parent3a75ef6a0fe397b0d36930415be6b123750a6afe (diff)
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')
-rw-r--r--chardev/char-socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 4fcdd8aedd..6d287babfb 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