about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2018-08-30T23·01+0200
committerDaiderd Jordan <daiderd@gmail.com>2018-09-02T10·54+0200
commit246acf93f2b61b2915e2140d761b19c2e836a96e (patch)
tree8e9d9416e25d07f2601a96ec03bdabaf8a0e0556 /src/nix
parent7314dc7f07a90782dea5cc9d298c7f7148e3b7c3 (diff)
nix doctor: handle serve protocol
The serve protocol used by LegacySSHStore has a different major and
shouldn't be compared to PROTOCOL_VERSION.
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/doctor.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nix/doctor.cc b/src/nix/doctor.cc
index 6ef5eb9d30e4..a31df595da88 100644
--- a/src/nix/doctor.cc
+++ b/src/nix/doctor.cc
@@ -1,4 +1,5 @@
 #include "command.hh"
+#include "serve-protocol.hh"
 #include "shared.hh"
 #include "store-api.hh"
 #include "worker-protocol.hh"
@@ -35,14 +36,18 @@ struct CmdDoctor : StoreCommand
         checkStoreProtocol(store->getProtocol());
     }
 
-    void checkStoreProtocol(unsigned int proto) {
-        if (PROTOCOL_VERSION != proto) {
+    void checkStoreProtocol(unsigned int storeProto) {
+        auto clientProto = GET_PROTOCOL_MAJOR(SERVE_PROTOCOL_VERSION) == GET_PROTOCOL_MAJOR(storeProto)
+            ? SERVE_PROTOCOL_VERSION
+            : PROTOCOL_VERSION;
+
+        if (clientProto != storeProto) {
             std::cout << "Warning: protocol version of this client does not match the store." << std::endl;
             std::cout << "While this is not necessarily a problem it's recommended to keep the client in" << std::endl;
             std::cout << "sync with the daemon." << std::endl;
             std::cout << std::endl;
-            std::cout << "Client protocol: " << formatProtocol(PROTOCOL_VERSION) << std::endl;
-            std::cout << "Store protocol: " << formatProtocol(proto) << std::endl;
+            std::cout << "Client protocol: " << formatProtocol(clientProto) << std::endl;
+            std::cout << "Store protocol: " << formatProtocol(storeProto) << std::endl;
             std::cout << std::endl;
         }
     }