Skip to content

Serialise packets into a buffer#1792

Merged
Rob-Hague merged 1 commit intosshnet:developfrom
Rob-Hague:sendbuffer
May 5, 2026
Merged

Serialise packets into a buffer#1792
Rob-Hague merged 1 commit intosshnet:developfrom
Rob-Hague:sendbuffer

Conversation

@Rob-Hague
Copy link
Copy Markdown
Collaborator

A byte array is allocated to hold each plaintext packet. This removes that by adding
a buffer for that purpose.

This is the last per-byte-sent allocation between the SSH channel layer and the socket transport. There remains one more in the SFTP layer.

Based on #1788, this change is the third commit

A byte array is allocated to hold each plaintext packet. This removes that by adding
a buffer for that purpose.
@Rob-Hague Rob-Hague merged commit 5b8382d into sshnet:develop May 5, 2026
11 of 12 checks passed
@Rob-Hague Rob-Hague deleted the sendbuffer branch May 5, 2026 11:41
Comment on lines 1079 to +1081
lock (_socketWriteLock)
{
var activeBufferLength = message.GetPacket(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

for posterity: I measured and did not see any increased lock contention from moving GetPacket inside the lock. Most parallel scenarios are already made serial by the lock in Channel.SendData

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