@@ -114,17 +114,17 @@ runStoreSocket preStoreConfig code =
114114
115115 sockPutS protoVersion ourProtoVersion
116116
117- when (daemonVersion >= ProtoVersion 1 14 )
117+ let minimumCommonVersion = min daemonVersion ourProtoVersion
118+
119+ when (minimumCommonVersion >= ProtoVersion 1 14 )
118120 $ sockPutS int (0 :: Int ) -- affinity, obsolete
119121
120- when (daemonVersion >= ProtoVersion 1 11 ) $ do
122+ when (minimumCommonVersion >= ProtoVersion 1 11 ) $ do
121123 sockPutS
122124 (mapErrorS RemoteStoreError_SerializerPut bool)
123125 False -- reserveSpace, obsolete
124126
125- -- not quite right, should be min of the two
126- -- as well as two ^ above
127- when (ourProtoVersion >= ProtoVersion 1 33 ) $ do
127+ when (minimumCommonVersion >= ProtoVersion 1 33 ) $ do
128128 -- If we were buffering I/O, we would flush the output here.
129129 _daemonNixVersion <-
130130 sockGetS
@@ -133,7 +133,7 @@ runStoreSocket preStoreConfig code =
133133 text
134134 return ()
135135
136- _remoteTrustsUs <- if ourProtoVersion >= ProtoVersion 1 35
136+ _remoteTrustsUs <- if minimumCommonVersion >= ProtoVersion 1 35
137137 then do
138138 sockGetS
139139 $ mapErrorS RemoteStoreError_SerializerHandshake trustedFlag
@@ -146,6 +146,4 @@ runStoreSocket preStoreConfig code =
146146 (\ (PreStoreConfig a b) -> StoreConfig a ourProtoVersion b)
147147 processOutput
148148
149- -- TODO should be minimum of
150- -- ourProtoVersion vs daemonVersion
151- pure ourProtoVersion
149+ pure minimumCommonVersion
0 commit comments