about summary refs log tree commit diff
path: root/src/nix-worker
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-worker')
-rw-r--r--src/nix-worker/main.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc
index 8ac69561f0bf..5d57dd6b62d4 100644
--- a/src/nix-worker/main.cc
+++ b/src/nix-worker/main.cc
@@ -37,11 +37,15 @@ void processConnection(Source & from, Sink & to)
     debug("greeting exchanged");
 
     bool quit = false;
+
+    unsigned int opCount = 0;
     
     do {
         
         WorkerOp op = (WorkerOp) readInt(from);
 
+        opCount++;
+
         switch (op) {
 
         case wopQuit:
@@ -75,13 +79,26 @@ void processConnection(Source & from, Sink & to)
             break;
         }
 
-        case wopAddToStore: {
+        case wopAddToStore:
+        case wopAddToStoreFixed: {
             /* !!! uberquick hack */
             string baseName = readString(from);
+            bool recursive = false;
+            string hashAlgo;
+            if (op == wopAddToStoreFixed) {
+                recursive = readInt(from) == 1;
+                hashAlgo = readString(from);
+            }
+
             Path tmp = createTempDir();
             Path tmp2 = tmp + "/" + baseName;
             restorePath(tmp2, from);
-            writeString(store->addToStore(tmp2), to);
+
+            if (op == wopAddToStoreFixed)
+                writeString(store->addToStoreFixed(recursive, hashAlgo, tmp2), to);
+            else
+                writeString(store->addToStore(tmp2), to);
+            
             deletePath(tmp);
             break;
         }
@@ -113,6 +130,8 @@ void processConnection(Source & from, Sink & to)
         }
         
     } while (!quit);
+
+    printMsg(lvlError, format("%1% worker operations") % opCount);
 }