Skip to content

Improve timeout and retry handling for large game libraries - #4

Open
wiibur wants to merge 1 commit into
ps2homebrew:mainfrom
wiibur:fix/improve-timeout-handling
Open

Improve timeout and retry handling for large game libraries#4
wiibur wants to merge 1 commit into
ps2homebrew:mainfrom
wiibur:fix/improve-timeout-handling

Conversation

@wiibur

@wiibur wiibur commented Nov 6, 2025

Copy link
Copy Markdown
  • 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. I was experiencing these issues once my library reached around 1TB in size installed on HDD.

- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread HDLGManClient/client.c

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

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment thread HDLGManClient/main.h
Comment on lines +15 to 17
#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. */

Copilot AI Nov 19, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
#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 uses AI. Check for mistakes.
@AKuHAK

AKuHAK commented Jan 1, 2026

Copy link
Copy Markdown
Member

@copilot open a new pull request to apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants