-
Notifications
You must be signed in to change notification settings - Fork 24
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: synchronize when resetting the keepalive timer #21
Conversation
320e99a
to
c7ed5b3
Compare
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.
yay for CI working
func (s *Session) extendKeepalive() { | ||
s.keepaliveLock.Lock() | ||
if s.keepaliveTimer != nil && !s.keepaliveActive { | ||
s.keepaliveTimer.Reset(s.config.KeepAliveInterval) |
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.
"Reset should be invoked only on stopped or expired timers with drained channels." - do we know that's the case here?
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.
already discussed in the previous pr...
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.
That's just bad documentation (#16 (comment)). Reset will actually call stop internally. The only reason you need to do it is if you need to drain the channel.
However, we're not even using a normal timer here.
4daa05b
to
ae174bd
Compare
ae174bd
to
4f3f477
Compare
* fix races * fix timeouts * disable some tests when the race detector is enabled (too slow, too many goroutines)
4f3f477
to
345f639
Compare
Ok, tests aren't perfect but they're much better. |
fixes #20
Also, fix the tests, test in CI 5 times and one more time with the race detector.