Kirill Batuzov writes: > Due to GLib limitations it is not possible to create several watches on one > channel on Windows hosts. See bug #338943 in GNOME bugzilla for details: > https://bugzilla.gnome.org/show_bug.cgi?id=338943 > > Handle G_IO_HUP in tcp_chr_read. It is already watched by corresponding watch. > Also remove the second watch with its handler. > > This reverts commit cdaa86a54b232572bba594bf87a7416e527e460c. > ("Add G_IO_HUP handler for socket chardev") but keeps its functionality. <snip> > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -2673,6 +2673,12 @@ static gboolean tcp_chr_read(GIOChannel *chan, > GIOCondition cond, void *opaque) > uint8_t buf[READ_BUF_LEN]; > int len, size; > > + if (cond & G_IO_HUP) { > + /* connection closed */ > + tcp_chr_disconnect(chr); > + return TRUE; > + }
Is this right. AIUI we could return FALSE here to remove the watch for the now closed channel. -- Alex Bennée