Amit Shah <amit.s...@redhat.com> wrote: > Add a non-blocking write handler that can return with -EAGAIN to the > caller and also callback when the socket becomes writable. > > Non-blocking writes are only enabled for sockets that are opened in > non-blocking mode and only for callers that have registered a callback > handler for resuming writes. > > Signed-off-by: Amit Shah <amit.s...@redhat.com>
I > static void tcp_chr_connect(void *opaque) > { > CharDriverState *chr = opaque; > TCPCharDriver *s = chr->opaque; > + IOHandler *write_cb; > + int flags; > + bool nonblock; > + > + flags = fcntl(s->fd, F_GETFL); > + if (flags == -1) { > + flags = 0; > + } > + nonblock = flags & O_NONBLOCK; > + > + write_cb = NULL; > + chr->nonblock = false; > + if (nonblock && chr->chr_write_unblocked) { > + write_cb = chr->chr_write_unblocked; > + chr->nonblock = true; > + } > > + chr->write_blocked = false; > s->connected = 1; > qemu_set_fd_handler2(s->fd, tcp_chr_read_poll, write_cb is a write-only variable, no?