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

Loophole doesn't reconnect after a network outage #259

Open
jarble opened this issue Apr 3, 2024 · 4 comments
Open

Loophole doesn't reconnect after a network outage #259

jarble opened this issue Apr 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jarble
Copy link

jarble commented Apr 3, 2024

My wireless network connection is occasionally disrupted. Whenever this happens, Loophole attempts to reconnect 5 times and then quits.

Instead of quitting when the network goes down, should Loophole stay open and attempt to reconnect when the network is available again?

@jarble jarble added the bug Something isn't working label Apr 3, 2024
@0x7f
Copy link
Contributor

0x7f commented Apr 4, 2024

Hi @jarble we have a hard-coded retry count here:

var sshRetries int = 5
var err error
for i := 0; i < sshRetries && !sshSuccess; i++ { // Connection retries in case of reconnect during gateway shutdown
communication.LoadingStart(tunnelID, "Initializing secure tunnel... ")
serverSSHConnHTTPS, err = ssh.Dial("tcp", config.Config.GatewayEndpoint.Hostname(), sshConfigHTTPS)
if err != nil {
communication.LoadingFailure(tunnelID, err)
communication.TunnelInfo(tunnelID, fmt.Sprintf("SSH Connection failed, retrying in 10 seconds... (Attempt %d/%d)", i+1, sshRetries))
time.Sleep(10 * time.Second)
} else {
sshSuccess = true
}
}
if !sshSuccess {
communication.TunnelError(tunnelID, "An error occured while dialing into SSH. If your connection has been running for a while, "+
"this might be caused by the server shutting down your connection. Dialing SSH Gateway for HTTPS failed.")
err = fmt.Errorf("failed %d", 5)
return nil, err
}
We could either always make it retry forever, or make the retry configurable via cli argument. @Morishiri what would you prefer?

@Morishiri
Copy link
Contributor

Morishiri commented Apr 4, 2024

let's make it configurable via cli, with 0 being infinity

@jarble
Copy link
Author

jarble commented Apr 29, 2024

@Morishiri and @0x7f If this becomes configurable, should it be "infinity" by default?

@xfearx1
Copy link

xfearx1 commented Sep 21, 2024

Hello, will this be a thing?
My network is also a little unstable, and sometimes it disconnects in the middle of the night, then for me find out just in the morning it was down for several hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants