diff options
author | zhanghailiang <zhang.zhanghailiang@huawei.com> | 2017-02-17 10:53:13 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2017-03-06 11:46:02 +0800 |
commit | 8487ce45f890cab208541f01e79579d7b25e1615 (patch) | |
tree | 0013e431aa3a34e0da0e3a9c5eb898e11314d619 /chardev/char-socket.c | |
parent | dfd917a9c2bed578c31043126c9f558190bf21e4 (diff) | |
download | qemu-8487ce45f890cab208541f01e79579d7b25e1615.zip qemu-8487ce45f890cab208541f01e79579d7b25e1615.tar.gz qemu-8487ce45f890cab208541f01e79579d7b25e1615.tar.bz2 |
char: remove the right fd been watched in qemu_chr_fe_set_handlers()
We can call qemu_chr_fe_set_handlers() to add/remove fd been watched
in 'context' which can be either default main context or other explicit
context. But the original logic is not correct, we didn't remove
the right fd because we call g_main_context_find_source_by_id(NULL, tag)
which always try to find the Gsource from default context.
Fix it by passing the right context to g_main_context_find_source_by_id().
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'chardev/char-socket.c')
-rw-r--r-- | chardev/char-socket.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 865c527..d7e92e1 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -328,7 +328,7 @@ static void tcp_chr_free_connection(Chardev *chr) } tcp_set_msgfds(chr, NULL, 0); - remove_fd_in_watch(chr); + remove_fd_in_watch(chr, NULL); object_unref(OBJECT(s->sioc)); s->sioc = NULL; object_unref(OBJECT(s->ioc)); @@ -498,7 +498,7 @@ static void tcp_chr_update_read_handler(Chardev *chr, return; } - remove_fd_in_watch(chr); + remove_fd_in_watch(chr, NULL); if (s->ioc) { chr->fd_in_tag = io_add_watch_poll(chr, s->ioc, tcp_chr_read_poll, |