-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[REQ][Qt5] Optional TimeOut #3064
Labels
Milestone
Comments
Good description of a possible solution. |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem?
Yes
Please describe.
I think Qt5 doesn't manage timeout problems by default. This means that if there is a timeout because of a firewall or an unresponsive server, the connection won't die since there is no mechanism to solve this situation.
Describe the solution you'd like
The usual solution is to set a Qtimer with setsingleshot=true and a timeout, then connect this qtimer timeout() signal to the QNetworkReply abort() slot. If the response happens before the timeout, then the timer has to be stopped. I think you can do this by connecting the finished signal of QNetworkReply to stop slot of the timer, or by calling stop manually when processing the response.
I thought of maybe making the constructor of the generated client depend on an optional timeout with a default value, for example MyConstructor(int timeout = 30). Another option is to set the optional timeout before making a request by using a simple setter.
I've also read about a complementary solution for a similar problem that consists in to combine the use of a qtimer with downloadProgress to check if a download has stopped or is slower than a threshold then abort the connection.
Describe alternatives you've considered
None comes to my mind
Additional context
The text was updated successfully, but these errors were encountered: