@@ -469,6 +469,13 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source, Repair
469469void RemoteStore::addMultipleToStore (
470470 PathsSource && pathsToCopy, Activity & act, RepairFlag repair, CheckSigsFlag checkSigs)
471471{
472+ if (getConnection ()->protoVersion .number < WorkerProto::Version::Number{1 , 32 }) {
473+ Store::addMultipleToStore (std::move (pathsToCopy), act, repair, checkSigs);
474+ return ;
475+ }
476+
477+ auto conn (getConnection ());
478+
472479 // `addMultipleToStore` is single threaded
473480 size_t bytesExpected = 0 ;
474481 for (auto & [pathInfo, _] : pathsToCopy) {
@@ -489,25 +496,18 @@ void RemoteStore::addMultipleToStore(
489496 *this ,
490497 WorkerProto::WriteConn{
491498 .to = sink,
492- .version = {.number = {.major = 1 , .minor = 16 }},
499+ .version = conn->protoVersion .features .contains (WorkerProto::featureVersionedAddToStoreMultiple)
500+ ? conn->protoVersion
501+ : WorkerProto::Version{.number = {.major = 1 , .minor = 16 }},
493502 },
494503 pathInfo);
495504 pathSource->drainInto (sink);
496505 pathsToCopy.pop_back ();
497506 }
498507 });
499508
500- addMultipleToStore (*source, repair, checkSigs);
501- }
502-
503- void RemoteStore::addMultipleToStore (Source & source, RepairFlag repair, CheckSigsFlag checkSigs)
504- {
505- if (getConnection ()->protoVersion >= WorkerProto::Version{.number = {1 , 32 }}) {
506- auto conn (getConnection ());
507- conn->to << WorkerProto::Op::AddMultipleToStore << repair << !checkSigs;
508- conn.withFramedSink ([&](Sink & sink) { source.drainInto (sink); });
509- } else
510- Store::addMultipleToStore (source, repair, checkSigs);
509+ conn->to << WorkerProto::Op::AddMultipleToStore << repair << !checkSigs;
510+ conn.withFramedSink ([&](Sink & sink) { source->drainInto (sink); });
511511}
512512
513513void RemoteStore::registerDrvOutput (const Realisation & info)
0 commit comments