Skip to content

Read the underlying buffer in SshDataStream #1638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 4, 2025

Conversation

Rob-Hague
Copy link
Collaborator

SshDataStream is a MemoryStream, so we can access the buffer directly. Also simplify some usage in PrivateKeyFile.

SshDataStream is a MemoryStream, so we can access the buffer directly.
Also simplify some usage in PrivateKeyFile.
/// Reads a length-prefixed byte array from the SSH data stream,
/// returned as a view over the underlying buffer.
/// </summary>
internal ArraySegment<byte> ReadBinarySegment()
Copy link
Collaborator Author

@Rob-Hague Rob-Hague May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later this will be used in SshData to remove large array allocations when reading e.g. ChannelDataMessage (the motivation for this change)

@Rob-Hague Rob-Hague merged commit 7c07b10 into sshnet:develop May 4, 2025
4 checks passed
@Rob-Hague Rob-Hague deleted the sshdatastream branch May 4, 2025 10:39
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