nbd/client: Split handshake into two functions
commit10b89988d6b0f5f2aed794bed5b4e774858548f4
authorEric Blake <eblake@redhat.com>
Thu, 17 Jan 2019 19:36:51 +0000 (17 13:36 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 21 Jan 2019 21:49:52 +0000 (21 15:49 -0600)
tree58976d76ef9a30bfbeb4791d5e8b8fb111581dc5
parent2b8d0954514192133b0119942edfd7a0c146900d
nbd/client: Split handshake into two functions

An upcoming patch will add the ability for qemu-nbd to list
the services provided by an NBD server.  Share the common
code of the TLS handshake by splitting the initial exchange
into a separate function, leaving only the export handling
in the original function.  Functionally, there should be no
change in behavior in this patch, although some of the code
motion may be difficult to follow due to indentation changes
(view with 'git diff -w' for a smaller changeset).

I considered an enum for the return code coordinating state
between the two functions, but in the end just settled with
ample comments.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190117193658.16413-15-eblake@redhat.com>
nbd/client.c
nbd/trace-events