From b3491c781cb4be55f981b7456fcdbe5c4f869f01 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 20 Jul 2015 01:16:16 +0200 Subject: More cleanup --- src/download-via-ssh/download-via-ssh.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/download-via-ssh') diff --git a/src/download-via-ssh/download-via-ssh.cc b/src/download-via-ssh/download-via-ssh.cc index 73f8860948b0..ed551ac461fb 100644 --- a/src/download-via-ssh/download-via-ssh.cc +++ b/src/download-via-ssh/download-via-ssh.cc @@ -43,8 +43,7 @@ static std::pair connect(const string & conn) static void substitute(std::pair & pipes, Path storePath, Path destPath) { - writeInt(cmdDumpStorePath, pipes.first); - writeString(storePath, pipes.first); + pipes.first << cmdDumpStorePath << storePath; pipes.first.flush(); restorePath(destPath, pipes.second); std::cout << std::endl; @@ -58,17 +57,17 @@ static void query(std::pair & pipes) string cmd = tokenized.front(); tokenized.pop_front(); if (cmd == "have") { - writeInt(cmdQueryValidPaths, pipes.first); - writeInt(0, pipes.first); // don't lock - writeInt(0, pipes.first); // don't substitute - writeStrings(tokenized, pipes.first); + pipes.first + << cmdQueryValidPaths + << 0 // don't lock + << 0 // don't substitute + << tokenized; pipes.first.flush(); PathSet paths = readStrings(pipes.second); for (auto & i : paths) std::cout << i << std::endl; } else if (cmd == "info") { - writeInt(cmdQueryPathInfos, pipes.first); - writeStrings(tokenized, pipes.first); + pipes.first << cmdQueryPathInfos << tokenized; pipes.first.flush(); while (1) { Path path = readString(pipes.second); @@ -116,13 +115,13 @@ int main(int argc, char * * argv) std::pair pipes = connect(host); /* Exchange the greeting */ - writeInt(SERVE_MAGIC_1, pipes.first); + pipes.first << SERVE_MAGIC_1; pipes.first.flush(); unsigned int magic = readInt(pipes.second); if (magic != SERVE_MAGIC_2) throw Error("protocol mismatch"); readInt(pipes.second); // Server version, unused for now - writeInt(SERVE_PROTOCOL_VERSION, pipes.first); + pipes.first << SERVE_PROTOCOL_VERSION; pipes.first.flush(); string arg = argv[1]; -- cgit 1.4.1