Skip to content
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

make net_input_bytes_curr_cmd more readable #1756

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

soloestoy
Copy link
Member

        /* Per-slot network bytes-in calculation, 3rd and 4th components.
         * Here, the deferred c->argc from 2nd component is added, resulting in c->argc * 5 instead of * 4. */
        c->net_input_bytes_curr_cmd += (c->argv_len_sum + (c->argc * 5 + 2));

When I was reading the code, this line confused me a bit. Why is it necessary to replace multiplying by 4 with multiplying by 5 here? Then I realized it was because the '$' character is included. So, I made some changes to make this calculation consistent with the description in the comments. Additionally, the counting for "\r\n" has also been moved to each part separately. I think this makes it more intuitive. WDYT @kyle-yh-kim ?

Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.11%. Comparing base (206f7f6) to head (f2290f8).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1756      +/-   ##
============================================
- Coverage     71.14%   71.11%   -0.03%     
============================================
  Files           123      123              
  Lines         65534    65534              
============================================
- Hits          46622    46606      -16     
- Misses        18912    18928      +16     
Files with missing lines Coverage Δ
src/networking.c 88.77% <100.00%> (-0.12%) ⬇️

... and 8 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant