chardev-socket: do not blindly reset handlers when switching GMainContext
PATCH v2 1/1 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é <[email protected]>
Reviewed-by Marc-André Lureau <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
--- chardev/char-socket.c | 2 +- tests/test-char.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 95 insertions(+), 2 deletions(-)
chardev/char-socket.c +1 -1
@@ -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
tests/test-char.c +94 -1
107 lines not on this page · raw message
Signature · 1 line
1.8.3.1