Use nix::serv_proto::BasicConnection in build_remote.cc

- Use the type itself

  This lays the foundation for being able to dedup the protocol code.

- Use `BasicConnection::handshake`, replacing ours.

- Use `BasicConnection::queryValidPaths`

- Use `BasicConnection::putBuildDerivationRequest`
This commit is contained in:
John Ericson
2022-02-20 19:51:28 +00:00
parent db7aa01b8d
commit 4ac31c89df
2 changed files with 26 additions and 61 deletions

View File

@@ -22,6 +22,7 @@
#include "sync.hh"
#include "nar-extractor.hh"
#include "serve-protocol.hh"
#include "serve-protocol-impl.hh"
typedef unsigned int BuildID;
@@ -302,29 +303,9 @@ struct Machine
}
// A connection to a machine
struct Connection {
nix::FdSource from;
nix::FdSink to;
nix::ServeProto::Version remoteVersion;
struct Connection : nix::ServeProto::BasicClientConnection {
// Backpointer to the machine
ptr machine;
operator nix::ServeProto::ReadConn ()
{
return {
.from = from,
.version = remoteVersion,
};
}
operator nix::ServeProto::WriteConn ()
{
return {
.to = to,
.version = remoteVersion,
};
}
};
};