-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix(tcpreuse): handle connection that failed to be sampled #3036
Conversation
279be8d
to
6eae9ab
Compare
func identifyConnType(c manet.Conn) (DemultiplexedConnType, manet.Conn, error) { | ||
if err := c.SetReadDeadline(time.Now().Add(identifyConnTimeout)); err != nil { | ||
closeErr := c.Close() | ||
return 0, nil, errors.Join(err, closeErr) | ||
} | ||
|
||
s, c, err := sampledconn.PeekBytes(c) |
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.
These changes aren't necessary, right? It's also not a peekableConn. It's just a manet.Conn. If you want to rename, i would rename the parameter.
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.
Ah, I see. This shadows the c
in L53.
The issue was that the returned connection may be nil when an error is returned, right? |
https://github.com/uber-go/nilaway Seems promising, but not sure if it would have caught this issue. |
0dc888b
to
5b834c7
Compare
5b834c7
to
a1ea5af
Compare
There was an oversight here in the error reporting. A test should be added, but also probably this should've been caught by automated tooling (e.g. one of the linters), maybe there are more we should be enabling.