Skip to main content

discover_session

Function discover_session 

Source
pub fn discover_session(
    answer: &JsonObject,
    supported: &SupportedVersions,
    config: &ClientConfig,
) -> Result<NegotiatedSession, HandshakeError>
Expand description

Reads a server/discover answer into a session.

Different from initialize_session by construction: the peer names a set of revisions and the client picks, there is no serverInfo to read, and the capabilities arrive under a key the older revisions do not use.

The pick is SupportedVersions::best_match — the newest revision both sides speak — rather than the client’s own preference. A client that picked its own preference would ignore a server that had dropped that revision, and would then be running on a version the server never offered.

§Errors

HandshakeError::MalformedResult when supportedVersions is absent or holds nothing this build speaks.