mirror of
https://github.com/NixOS/nix
synced 2025-06-28 01:11:15 +02:00
Factor out ServeProto::BasicClientConnection::handshake
Hydra to share
This commit is contained in:
parent
4580bed3e4
commit
4a5ca576da
3 changed files with 43 additions and 9 deletions
|
@ -63,6 +63,28 @@ struct ServeProto::BasicClientConnection
|
|||
FdSource from;
|
||||
ServeProto::Version remoteVersion;
|
||||
|
||||
/**
|
||||
* Establishes connection, negotiating version.
|
||||
*
|
||||
* @return the version provided by the other side of the
|
||||
* connection.
|
||||
*
|
||||
* @param to Taken by reference to allow for various error handling
|
||||
* mechanisms.
|
||||
*
|
||||
* @param from Taken by reference to allow for various error
|
||||
* handling mechanisms.
|
||||
*
|
||||
* @param localVersion Our version which is sent over
|
||||
*
|
||||
* @param host Just used to add context to thrown exceptions.
|
||||
*/
|
||||
static ServeProto::Version handshake(
|
||||
BufferedSink & to,
|
||||
Source & from,
|
||||
ServeProto::Version localVersion,
|
||||
std::string_view host);
|
||||
|
||||
/**
|
||||
* Coercion to `ServeProto::ReadConn`. This makes it easy to use the
|
||||
* factored out serve protocol serializers with a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue