-
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
Disable keepalives in server. #150
Conversation
The server doesn't always seem to detect when a client disappears off the net. This diff adds a mechanism to knock current connections offline if a duplicate ID comes in. This is annoying when the user may accidentally have two zkclients open but it beats being locked out of zkserver for hours at a time.
zkserver/zkserver.go
Outdated
z.Dbg(idS, "handleSession forced offline: %v", rids) | ||
z.Lock() | ||
oldSc, ok := z.sessions[rids] | ||
if ok { |
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.
can get rid of if else if you just do a if !ok
instead.
@@ -659,8 +700,7 @@ func (z *ZKS) listen() error { | |||
continue | |||
} | |||
|
|||
conn.(*net.TCPConn).SetKeepAlive(true) | |||
conn.(*net.TCPConn).SetKeepAlivePeriod(time.Second) | |||
conn.(*net.TCPConn).SetKeepAlive(false) |
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.
recommend just removing altogether
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.
I like it being explicit and I don't know what the OS is doing underneath.
Disable keep-alives and cull online connections on repeated client connections.
Fixes #149