mirror of
https://github.com/NixOS/nix
synced 2025-07-04 19:41:48 +02:00
Factor our ServeProto::BasicServerConnection::handshake
We'll need this for unit testing. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
4a5ca576da
commit
e960b28230
4 changed files with 38 additions and 5 deletions
|
@ -22,6 +22,18 @@ ServeProto::Version ServeProto::BasicClientConnection::handshake(
|
|||
return remoteVersion;
|
||||
}
|
||||
|
||||
ServeProto::Version ServeProto::BasicServerConnection::handshake(
|
||||
BufferedSink & to,
|
||||
Source & from,
|
||||
ServeProto::Version localVersion)
|
||||
{
|
||||
unsigned int magic = readInt(from);
|
||||
if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch");
|
||||
to << SERVE_MAGIC_2 << localVersion;
|
||||
to.flush();
|
||||
return readInt(from);
|
||||
}
|
||||
|
||||
|
||||
StorePathSet ServeProto::BasicClientConnection::queryValidPaths(
|
||||
const Store & store,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue