Commit 1a6245a5 authored by Fam Zheng's avatar Fam Zheng Committed by Paolo Bonzini

nbd-server: Coroutine based negotiation

Create a coroutine in nbd_client_new, so that nbd_send_negotiate doesn't
need qemu_set_block().

Handlers need to be set temporarily for csock fd in case the coroutine
yields during I/O.

With this, if the other end disappears in the middle of the negotiation,
we don't block the whole event loop.

To make the code clearer, unify all function names that belong to
negotiate, so they are less likely to be misused. This is important
because we rely on negotiation staying in main loop, as commented in
Signed-off-by: 's avatarFam Zheng <>
Message-Id: <>
Signed-off-by: 's avatarPaolo Bonzini <>
parent 798bfe00
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment