Skip to content

Stop waiting for an internet connection after 30 seconds - #5487

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
Devolutions:mainfrom
Arthur031221:fix-internet-wait-timeout
Oct 8, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 2 commits into
Devolutions:mainfrom
Arthur031221:fix-internet-wait-timeout

Conversation

@Arthur031221

Copy link
Copy Markdown
Contributor
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved?
    If the same issue can be reproduced outside UniGetUI with the relevant package manager or with the package itself, please report it there first. UniGetUI should only be used to track issues that are specific to UniGetUI's behavior or integration.

UniGetUI waited for the system to report internet access with no time limit, so loading hung when the system kept saying there was no internet.

This picks up #5128 by Zeroes1. The wait now stops after 30 seconds and loading goes on, and a successful HTTP check ends it sooner. It swaps the obsolete WebRequest for HttpClient, uses www.msftconnecttest.com (the bare domain doesn't resolve), and checks the page text so a captive portal's 200 page doesn't count.

Added ConnectivityWaitTests (dotnet test src/UniGetUI.Core.Tools.Tests). With no network interface, WaitForInternetConnection() used to hang and now returns after 30 seconds. The Windows-only check compiles but wasn't run.

Relates to #3669

I used Claude/Codex to assist with preparing, checking and double-checking this change.

Co-authored-by: Zeroes1 11919060+Zeroes1@users.noreply.github.com

Package loading waited for the system to report internet access with no
limit, so a wrong answer from the system left the app on "Loading
packages" for good. The wait now gives up after 30 seconds and goes on.
A successful request to the connectivity test page also ends it at
once, which covers a stale system answer. The page text is checked so
that a captive portal answering 200 does not count as internet access.

Co-authored-by: Zeroes1 <11919060+Zeroes1@users.noreply.github.com>
Comment thread src/UniGetUI.Core.Tools/Tools.cs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Before I approve, could you address the inline comment about DNS stalls stretching the timeout? Either a hard limit on the request or a note in the doc comment is fine. The rest looks good to me.

The check now sends its request with SendAsync and stops waiting for it
at the time limit, so it returns on time even if the request does not
stop when HttpClient.Timeout fires. The request is then left to end on
its own. Added a test with a request that ignores cancellation.
@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 9bfbe4b into Devolutions:main Oct 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants