On 11/01/2016 04:36, Fam Zheng wrote:
>
> + aio_set_fd_handler(ctx, client->sock, true,
> + nbd_negotiate_continue,
> + nbd_negotiate_continue, data->co);
> TRACE("Beginning negotiation.");
> memset(buf, 0, sizeof(buf));
This causes a busy loop if the socket is writable but the client does
not send data. I think you need to set/clear the handler (using
qemu_coroutine_self() instead of data->co, probably) every time the
direction of negotiation switches. That is, set only a read handler
before read_sync, and only a write handler before write_sync.
Paolo