Skip to content

Inline ProtocolVersionExchange into Session - #1867

Merged
Rob-Hague merged 3 commits into
sshnet:developfrom
Rob-Hague:protocolversionexch
Nov 15, 2026
Merged

Rob-Hague merged 3 commits into
sshnet:developfrom
Rob-Hague:protocolversionexch

Conversation

@Rob-Hague

Copy link
Copy Markdown
Collaborator

Two motivating reasons:

  1. Rather than reading one byte at a time from the socket, we can use the receive buffer
    to read as much as is available. Once we've read out the SSH identification, leftover
    bytes are processed as the kexinit messages as normal.
  2. To replace explicit tests and mocks on internals (ProtocolVersionExchange class) with
    tests on public API. This is a first attempt in that direction.

The logic is also rewritten to use spans on bytes rather than materialising strings and
using regex.

Two motivating reasons:

1. Rather than reading one byte at a time from the socket, we can use the receive buffer
   to read as much as is available. Once we've read out the SSH identification, leftover
   bytes are processed as the kexinit messages as normal.
2. To replace explicit tests and mocks on internals (ProtocolVersionExchange class) with
   tests on public API. This is a first attempt in that direction.

The logic is also rewritten to use spans on bytes rather than materialising strings and
using regex.
# Conflicts:
#	src/Renci.SshNet/Connection/ProtocolVersionExchange.cs
@Rob-Hague
Rob-Hague merged commit d92cca5 into sshnet:develop Nov 15, 2026
6 checks passed
@Rob-Hague
Rob-Hague deleted the protocolversionexch branch November 15, 2026 10:46
@Rob-Hague

Copy link
Copy Markdown
Collaborator Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants