@@ -413,12 +413,10 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
413
413
options.pathsToDelete = readStorePaths<PathSet>(*store, from);
414
414
options.ignoreLiveness = readInt (from);
415
415
options.maxFreed = readLongLong (from);
416
- readInt (from); // obsolete field
417
- if (GET_PROTOCOL_MINOR (clientVersion) >= 5 ) {
418
- /* removed options */
419
- readInt (from);
420
- readInt (from);
421
- }
416
+ // obsolete fields
417
+ readInt (from);
418
+ readInt (from);
419
+ readInt (from);
422
420
423
421
GCResults results;
424
422
@@ -440,17 +438,12 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
440
438
verbosity = (Verbosity) readInt (from);
441
439
settings.set (" build-max-jobs" , std::to_string (readInt (from)));
442
440
settings.set (" build-max-silent-time" , std::to_string (readInt (from)));
443
- if (GET_PROTOCOL_MINOR (clientVersion) >= 2 )
444
- settings.useBuildHook = readInt (from) != 0 ;
445
- if (GET_PROTOCOL_MINOR (clientVersion) >= 4 ) {
446
- settings.verboseBuild = lvlError == (Verbosity) readInt (from);
447
- readInt (from); // obsolete logType
448
- readInt (from); // obsolete printBuildTrace
449
- }
450
- if (GET_PROTOCOL_MINOR (clientVersion) >= 6 )
451
- settings.set (" build-cores" , std::to_string (readInt (from)));
452
- if (GET_PROTOCOL_MINOR (clientVersion) >= 10 )
453
- settings.set (" build-use-substitutes" , readInt (from) ? " true" : " false" );
441
+ settings.useBuildHook = readInt (from) != 0 ;
442
+ settings.verboseBuild = lvlError == (Verbosity) readInt (from);
443
+ readInt (from); // obsolete logType
444
+ readInt (from); // obsolete printBuildTrace
445
+ settings.set (" build-cores" , std::to_string (readInt (from)));
446
+ settings.set (" build-use-substitutes" , readInt (from) ? " true" : " false" );
454
447
if (GET_PROTOCOL_MINOR (clientVersion) >= 12 ) {
455
448
unsigned int n = readInt (from);
456
449
for (unsigned int i = 0 ; i < n; i++) {
@@ -478,9 +471,7 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
478
471
if (i == infos.end ())
479
472
to << 0 ;
480
473
else {
481
- to << 1 << i->second .deriver << i->second .references << i->second .downloadSize ;
482
- if (GET_PROTOCOL_MINOR (clientVersion) >= 7 )
483
- to << i->second .narSize ;
474
+ to << 1 << i->second .deriver << i->second .references << i->second .downloadSize << i->second .narSize ;
484
475
}
485
476
break ;
486
477
}
@@ -585,11 +576,13 @@ static void processConnection(bool trusted)
585
576
to.flush ();
586
577
unsigned int clientVersion = readInt (from);
587
578
579
+ if (clientVersion < 0x10a )
580
+ throw Error (" the Nix client version is too old" );
581
+
588
582
if (GET_PROTOCOL_MINOR (clientVersion) >= 14 && readInt (from))
589
583
setAffinityTo (readInt (from));
590
584
591
- if (GET_PROTOCOL_MINOR (clientVersion) >= 11 )
592
- readInt (from); // obsolete reserveSpace
585
+ readInt (from); // obsolete reserveSpace
593
586
594
587
/* Send startup error messages to the client. */
595
588
startWork ();
@@ -636,10 +629,10 @@ static void processConnection(bool trusted)
636
629
during addTextToStore() / importPath(). If that
637
630
happens, just send the error message and exit. */
638
631
bool errorAllowed = canSendStderr;
639
- stopWork (false , e.msg (), GET_PROTOCOL_MINOR (clientVersion) >= 8 ? e.status : 0 );
632
+ stopWork (false , e.msg (), e.status );
640
633
if (!errorAllowed) throw ;
641
634
} catch (std::bad_alloc & e) {
642
- stopWork (false , " Nix daemon out of memory" , GET_PROTOCOL_MINOR (clientVersion) >= 8 ? 1 : 0 );
635
+ stopWork (false , " Nix daemon out of memory" , 1 );
643
636
throw ;
644
637
}
645
638
@@ -653,7 +646,7 @@ static void processConnection(bool trusted)
653
646
printMsg (lvlDebug, format (" %1% operations" ) % opCount);
654
647
655
648
} catch (Error & e) {
656
- stopWork (false , e.msg (), GET_PROTOCOL_MINOR (clientVersion) >= 8 ? 1 : 0 );
649
+ stopWork (false , e.msg (), 1 );
657
650
to.flush ();
658
651
return ;
659
652
}
0 commit comments