mirror of
https://github.com/NixOS/nix
synced 2025-07-03 10:21:47 +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
|
@ -828,11 +828,9 @@ static void opServe(Strings opFlags, Strings opArgs)
|
|||
FdSink out(STDOUT_FILENO);
|
||||
|
||||
/* Exchange the greeting. */
|
||||
unsigned int magic = readInt(in);
|
||||
if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch");
|
||||
out << SERVE_MAGIC_2 << SERVE_PROTOCOL_VERSION;
|
||||
out.flush();
|
||||
ServeProto::Version clientVersion = readInt(in);
|
||||
ServeProto::Version clientVersion =
|
||||
ServeProto::BasicServerConnection::handshake(
|
||||
out, in, SERVE_PROTOCOL_VERSION);
|
||||
|
||||
ServeProto::ReadConn rconn {
|
||||
.from = in,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue