Skip to content

Commit 91cd425

Browse files
committed
Introduce MINIMUM_PROTOCOL_VERSION constant
1 parent 1af5a98 commit 91cd425

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/libstore/daemon.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ void processConnection(ref<Store> store, FdSource && from, FdSink && to, Trusted
10311031
auto [protoVersion, features] =
10321032
WorkerProto::BasicServerConnection::handshake(to, from, PROTOCOL_VERSION, WorkerProto::allFeatures);
10331033

1034-
if (protoVersion < 256 + 18)
1034+
if (protoVersion < MINIMUM_PROTOCOL_VERSION)
10351035
throw Error("the Nix client version is too old");
10361036

10371037
WorkerProto::BasicServerConnection conn;

src/libstore/include/nix/store/worker-protocol.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace nix {
1313
/* Note: you generally shouldn't change the protocol version. Define a
1414
new `WorkerProto::Feature` instead. */
1515
#define PROTOCOL_VERSION (1 << 8 | 38)
16+
#define MINIMUM_PROTOCOL_VERSION (1 << 8 | 18)
1617
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
1718
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
1819

src/libstore/remote-store.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void RemoteStore::initConnection(Connection & conn)
7373
try {
7474
auto [protoVersion, features] =
7575
WorkerProto::BasicClientConnection::handshake(conn.to, tee, PROTOCOL_VERSION, WorkerProto::allFeatures);
76-
if (protoVersion < 256 + 18)
76+
if (protoVersion < MINIMUM_PROTOCOL_VERSION)
7777
throw Error("the Nix daemon version is too old");
7878
conn.protoVersion = protoVersion;
7979
conn.features = features;

0 commit comments

Comments
 (0)