-
-
Notifications
You must be signed in to change notification settings - Fork 197
Removes dead connections #258
base: master
Are you sure you want to change the base?
Conversation
| for { | ||
| select { | ||
| case <-timer.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.
You can just do for range timer.C instead
| @@ -1,2 +0,0 @@ | |||
| #!/bin/bash | |||
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.
Please keep this file
| @@ -1,3 +0,0 @@ | |||
| #!/bin/bash | |||
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.
Please keep this file
| loadData() | ||
|
|
||
| // Spawn timer to clean dead connections every 5 mins | ||
| timer := time.NewTicker(5 * time.Minute) |
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 think every 5 minutes might be overly conservative
| for i, c := range activeClients { | ||
| if c.Hostname == ac.Hostname { | ||
| activeClients = append(activeClients[:i], activeClients[i+1:]...) | ||
| } | ||
| } |
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 think this might introduce a bug where for whatever reason 2 client instances run on the same machine, this should therefore also check if the old session still works and keep it in that case.
| for i, _ := range activeClients { | ||
| ac := getClient(i) | ||
| if err := ac.getHostname(); err != nil { | ||
| activeClients = append(activeClients[:i], activeClients[i+1:]...) |
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.
Add a notification that a client disconnected
[-] Client %name disconnected.
I have not tested this fully but it compiles correctly. When I have time I will test
Fixes Issue #247