nbd: invert client logic for negotiating protocol version
commitf72d705f0de9ec49248e72cf888624994f09eda2
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 10 Feb 2016 18:41:05 +0000 (10 18:41 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Feb 2016 16:14:08 +0000 (16 17:14 +0100)
tree5ed3ba60b3faade70aa382bf73ad7956c145204e
parent1c778ef729dd50d4b06780af1f44b69c63c532f8
nbd: invert client logic for negotiating protocol version

The nbd_receive_negotiate() method takes different code
paths based on whether 'name == NULL', and then checks
the expected protocol version in each branch.

This patch inverts the logic, so that it takes different
code paths based on what protocol version it receives and
then checks if name is NULL or not as needed.

This facilitates later code which allows the client to
be capable of using the new style protocol regardless
of whether an export name is listed or not.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1455129674-17255-8-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd/client.c