about summary refs log tree commit diff
path: root/src/libstore/remote-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T20·13+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T20·13+0000
commita711689368fe0915a2f18ea61fe6e953647d0174 (patch)
treed108cd2c072d1cf20efff5c18bd1a59b74664aa5 /src/libstore/remote-store.cc
parent765bdfe542d3250329dea98b69db2271419f31b6 (diff)
* First remote operation: isValidPath().
Diffstat (limited to 'src/libstore/remote-store.cc')
-rw-r--r--src/libstore/remote-store.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 6f3c110a3d..f59fe8b982 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -1,6 +1,7 @@
 #include "serialise.hh"
 #include "util.hh"
 #include "remote-store.hh"
+#include "worker-protocol.hh"
 
 #include <iostream>
 #include <unistd.h>
@@ -55,27 +56,36 @@ RemoteStore::RemoteStore()
 
     
     /* Send the magic greeting, check for the reply. */
-    writeInt(0x6e697864, to);
+    writeInt(WORKER_MAGIC_1, to);
     
     unsigned int magic = readInt(from);
-    if (magic != 0x6478696e) throw Error("protocol mismatch");
+    if (magic != WORKER_MAGIC_2) throw Error("protocol mismatch");
 }
 
 
 RemoteStore::~RemoteStore()
 {
+    writeInt(wopQuit, to);
+    readInt(from);
+    child.wait(true);
 }
 
 
 bool RemoteStore::isValidPath(const Path & path)
 {
-    throw Error("not implemented");
+    writeInt(wopIsValidPath, to);
+    writeString(path, to);
+    unsigned int reply = readInt(from);
+    return reply != 0;
 }
 
 
 Substitutes RemoteStore::querySubstitutes(const Path & srcPath)
 {
-    throw Error("not implemented");
+    //    writeInt(wopQuerySubstitutes);
+    
+    // throw Error("not implemented 2");
+    return Substitutes();
 }