Skip to content

added the reconnect timeout#2026

Open
Ankit8969 wants to merge 3 commits intonovnc:masterfrom
Ankit8969:reconnect_timeout
Open

added the reconnect timeout#2026
Ankit8969 wants to merge 3 commits intonovnc:masterfrom
Ankit8969:reconnect_timeout

Conversation

@Ankit8969
Copy link
Copy Markdown

This update introduces a maximum reconnect timeout for the VNC client. Currently, when the VNC client attempts to reconnect, it may continue retrying indefinitely if the connection keeps failing, which is not ideal.

With this change, we add a new configuration key, reconnect_max_time, in default.json. This setting allows us to define a maximum duration for reconnection attempts. Once the specified time limit is reached, the client will stop trying to reconnect, preventing unnecessary retries and improving overall stability.

@Ankit8969
Copy link
Copy Markdown
Author

@samhed, please check this PR

Copy link
Copy Markdown
Member

@samhed samhed left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. I didn't test it yet, but a few comments from briefly checking the code.

app/ui.js Outdated
if ((Date.now() - UI.firstReconnectTime) >= maxTime) {
// hiding the previous status message
UI.hideStatus();
UI.showStatus(_("Maximum reconnect attempts reached. Failed to connect to the server."), 'error', 1000*60*240); // Show for 4 hours
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why would this be limited in how long it is shown?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have changed it to a long time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did you test that code? Such a timeout executes instantly for me. See https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout#maximum_delay_value

I'd suggest modifying showStatus to do what you want instead.

@samhed samhed added the feature label Mar 24, 2026
@Ankit8969 Ankit8969 requested a review from samhed March 27, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants