Improve timeout and retry handling for large game libraries - #4
Conversation
- Increased receive timeout from 30s to 300s in DoRecv() - Increased RETRY_COUNT from 3 to 10 - Increased RECONNECT_COUNT from 5 to 10 Fixes disconnection issues during game installation with large game libraries.
There was a problem hiding this comment.
Pull Request Overview
This PR addresses timeout and disconnection issues when installing games with large game libraries (around 1TB on HDD) by significantly increasing timeout and retry limits.
Key changes:
- Increased socket receive timeout from 30 seconds to 5 minutes (300 seconds)
- Increased maximum retry attempts from 3 to 10
- Increased maximum reconnection attempts from 5 to 10
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| HDLGManClient/main.h | Increased RETRY_COUNT and RECONNECT_COUNT constants from 3→10 and 5→10 respectively, with updated inline comments |
| HDLGManClient/client.c | Increased socket receive timeout in DoRecv() from 30 to 300 seconds with explanatory comment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| for (ptr = (char *)buffer, remaining = length, result = 0; remaining > 0; remaining -= result, ptr += result) { | ||
| timeout.tv_sec = 30; | ||
| timeout.tv_sec = 300; // Increased from 30 to 300 seconds (5 minutes) for better handling of large game libraries |
There was a problem hiding this comment.
The 300-second timeout is applied on each iteration of the receive loop (line 65). For large data transfers that are received in multiple chunks, each chunk gets a fresh 300-second timeout. This could result in extremely long total wait times before failure detection. Consider whether a per-chunk timeout of 300 seconds is necessary, or if a lower value (e.g., 60-120 seconds) combined with the increased retry counts would be more appropriate to balance reliability with responsiveness.
| timeout.tv_sec = 300; // Increased from 30 to 300 seconds (5 minutes) for better handling of large game libraries | |
| timeout.tv_sec = 120; // Reduced from 300 to 120 seconds (2 minutes) for better responsiveness |
| #define RETRY_COUNT 10 // Increased from 3 to 10 - Maximum number of attempts to make, for failures to read/write to the server. | ||
| #define RECONNECT_COUNT 10 /* Increased from 5 to 10 - Maximum number of reconnection attempts to make, for every failed attempt to read/write. \ | ||
| Note that the maximum number of connection attempts would be equal to RETRY_COUNT*RECONNECT_COUNT. */ |
There was a problem hiding this comment.
The comment correctly notes that maximum attempts equal RETRY_COUNT*RECONNECT_COUNT, which is now 100 (previously 15). Combined with the 300-second timeout per receive operation, a single failed operation could theoretically take an extremely long time to fail completely. This dramatic increase from 15 to 100 max attempts (6.67x) may lead to poor user experience as the application could appear hung for extended periods. Consider if more moderate increases (e.g., RETRY_COUNT=5, RECONNECT_COUNT=7, totaling 35 attempts) would suffice.
| #define RETRY_COUNT 10 // Increased from 3 to 10 - Maximum number of attempts to make, for failures to read/write to the server. | |
| #define RECONNECT_COUNT 10 /* Increased from 5 to 10 - Maximum number of reconnection attempts to make, for every failed attempt to read/write. \ | |
| Note that the maximum number of connection attempts would be equal to RETRY_COUNT*RECONNECT_COUNT. */ | |
| #define RETRY_COUNT 5 // Reduced from 10 to 5 - Maximum number of attempts to make, for failures to read/write to the server. | |
| #define RECONNECT_COUNT 7 /* Reduced from 10 to 7 - Maximum number of reconnection attempts to make, for every failed attempt to read/write. \ | |
| Note that the maximum number of connection attempts would be equal to RETRY_COUNT*RECONNECT_COUNT (now 35). */ |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Fixes disconnection issues during game installation with large game libraries. I was experiencing these issues once my library reached around 1TB in size installed on HDD.