Skip to content

Fix copy-paste bugs in settings.c for TlsServerMaxSendBuffer#5823

Merged
guhetier merged 5 commits intomainfrom
copilot/remove-duplicate-code-settings
Mar 2, 2026
Merged

Fix copy-paste bugs in settings.c for TlsServerMaxSendBuffer#5823
guhetier merged 5 commits intomainfrom
copilot/remove-duplicate-code-settings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

Three copy-paste bugs in src/core/settings.c caused TlsServerMaxSendBuffer to never be properly initialized with its default value or propagated during settings merge/copy. A full scan of the file confirmed no further instances of this pattern remain.

Description

  • Default initialization (QuicSettingsSetDefault): Second if block was checking/assigning TlsClientMaxSendBuffer with QUIC_MAX_TLS_SERVER_SEND_BUFFER — corrected to check and assign TlsServerMaxSendBuffer.
  • Settings copy/merge (QuicSettingsCopy): Two duplicate blocks (exact copies of the TlsClientMaxSendBuffer block) were silently no-ops for TlsServerMaxSendBuffer — both corrected to operate on TlsServerMaxSendBuffer (one at the originally reported location ~line 530, and one additional instance found at line 249).
  • Full scan: All three functions that follow this pattern (QuicSettingsSetDefault, QuicSettingsCopy, QuicSettingsMerge) were audited and confirmed to have no remaining instances of this bug.

Testing

No existing tests cover these specific fields directly. The bugs were logic errors (dead/duplicate code paths), not behavioral regressions, so no new tests are added.

Documentation

No documentation impact.

Original prompt

This section details on the original issue you should resolve

<issue_title>Duplicate code in src/core/settings.c</issue_title>
<issue_description>

Source

  1. In src/core/settings.c, Lines 530-533 and Lines 534-537 are exactly the same.
  2. Lines 90-92 and Lines 93-95 are almost the same, except in the line 95 Settings->TlsClientMaxSendBuffer is set to QUIC_MAX_TLS_SERVER_SEND_BUFFER (which was previously set to QUIC_MAX_TLS_CLIENT_SEND_BUFFER.

</issue_description>

<agent_instructions>Fix the issue, remove duplicate code</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits February 26, 2026 22:41
Co-authored-by: saikat107 <2145576+saikat107@users.noreply.github.com>
Co-authored-by: saikat107 <2145576+saikat107@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate code in src/core/settings.c Fix copy-paste bugs in settings.c for TlsServerMaxSendBuffer Feb 26, 2026
Co-authored-by: saikat107 <2145576+saikat107@users.noreply.github.com>
@saikat107 saikat107 marked this pull request as ready for review February 26, 2026 22:50
@saikat107 saikat107 requested a review from a team as a code owner February 26, 2026 22:50
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.66%. Comparing base (26c3dfa) to head (ad77ae8).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/core/settings.c 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5823      +/-   ##
==========================================
- Coverage   86.11%   85.66%   -0.45%     
==========================================
  Files          60       60              
  Lines       18729    18729              
==========================================
- Hits        16129    16045      -84     
- Misses       2600     2684      +84     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…erMaxSendBuffer

Co-authored-by: saikat107 <2145576+saikat107@users.noreply.github.com>
@saikat107
Copy link
Copy Markdown
Contributor

@copilot, is there other places in settings.c where this pattern is applicable?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot, is there other places in settings.c where this pattern is applicable?

I've scanned all three functions in settings.c where these patterns appear (QuicSettingsSetDefault, QuicSettingsCopy, and QuicSettingsMerge) and no further instances of this copy-paste bug remain. The three bugs that were fixed cover all occurrences.

@guhetier
Copy link
Copy Markdown
Collaborator

guhetier commented Mar 2, 2026

Looks good to me, thanks for the PR.
It would be good to add the test that found that issue, are you planning to add it later on with all the related tests from Deeptest?

@saikat107
Copy link
Copy Markdown
Contributor

Looks good to me, thanks for the PR. It would be good to add the test that found that issue, are you planning to add it later on with all the related tests from Deeptest?

Will contribute with full DeepTest tests.

@guhetier guhetier merged commit ec046ee into main Mar 2, 2026
525 of 526 checks passed
@guhetier guhetier deleted the copilot/remove-duplicate-code-settings branch March 2, 2026 21:45
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.

Duplicate code in src/core/settings.c

3 participants