-
Notifications
You must be signed in to change notification settings - Fork 11
Implement tcp proxy with streaming example #8
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
base: main
Are you sure you want to change the base?
Conversation
case <-ctx.Done(): | ||
return | ||
default: | ||
buf, err := reader.ReadBinary(reader.Len()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add reader.Peek(1) before ReadBinary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use reader.Next(reader.Len()) to reduce copy.
return | ||
} | ||
|
||
alloc, err := writer.Malloc(len(buf)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use WriteBinary to reduce copy
|
||
copy(alloc, buf) | ||
|
||
if writer.MallocLen() > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to judge MallocLen here.
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
实现带有流式传输示例的 TCP 代理
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en: Implementing an example for tcp proxy application with nocopy API
zh(optional):
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: