Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Removes dead connections #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JustinTimperio
Copy link
Contributor

I have not tested this fully but it compiles correctly. When I have time I will test
Fixes Issue #247

Comment on lines +88 to +90
for {
select {
case <-timer.C:
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this file

@@ -80,6 +81,23 @@ func Start() error {
log.Println("Onion service running:", service.ID+".onion")

loadData()

// Spawn timer to clean dead connections every 5 mins
timer := time.NewTicker(5 * time.Minute)
Copy link
Owner

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

Comment on lines +139 to +143
for i, c := range activeClients {
if c.Hostname == ac.Hostname {
activeClients = append(activeClients[:i], activeClients[i+1:]...)
}
}
Copy link
Owner

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:]...)
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants