Skip to content
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

twice set for stream.readDeadline #11

Closed
terryding77 opened this issue Jan 17, 2020 · 1 comment · Fixed by #12
Closed

twice set for stream.readDeadline #11

terryding77 opened this issue Jan 17, 2020 · 1 comment · Fixed by #12

Comments

@terryding77
Copy link
Contributor

go-yamux/stream.go

Lines 311 to 325 in 736c1cb

func (s *Stream) forceClose() {
s.stateLock.Lock()
switch s.state {
case streamClosed:
// Already successfully closed. It just hasn't been removed from
// the list of streams yet.
default:
s.state = streamReset
}
s.stateLock.Unlock()
s.notifyWaiting()
s.readDeadline.set(time.Time{})
s.readDeadline.set(time.Time{})
}

go-yamux/stream.go

Lines 328 to 333 in 736c1cb

func (s *Stream) cleanup() {
s.session.closeStream(s.id)
s.readDeadline.set(time.Time{})
s.readDeadline.set(time.Time{})
}

I find in Stream.forceClose and stream.cleanup functions, we set the readDeadline twice, is there any trick for deadline? or it just the wrong typo for writeDeadline?

@Stebalien
Copy link
Member

Nice catch! Yeah, that's wrong. It likely only leaked timers for a short period of time but still...

Mind submitting a PR to fix it?

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 a pull request may close this issue.

2 participants