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

Constness TCPSocket::read/write methods #157

Merged
merged 2 commits into from
Jan 16, 2025
Merged

Conversation

mcakircali
Copy link
Contributor

No description provided.

@mcakircali mcakircali requested a review from danovaro January 14, 2025 14:40
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.

Project coverage is 63.75%. Comparing base (de9e9a2) to head (2e0229b).

Files with missing lines Patch % Lines
src/eckit/net/TCPSocket.cc 0.00% 24 Missing ⚠️
src/eckit/net/ProxiedTCPClient.cc 0.00% 1 Missing ⚠️
src/eckit/net/TCPSocket.h 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #157   +/-   ##
========================================
  Coverage    63.74%   63.75%           
========================================
  Files         1066     1066           
  Lines        55360    55353    -7     
  Branches      4086     4086           
========================================
  Hits         35289    35289           
+ Misses       20071    20064    -7     

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

Copy link

Private downstream CI failed.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12771044368.

char mode_;
mutable bool debug_;
mutable bool newline_;
mutable char mode_;
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look right.

mode_ (IIRC) should only be being set in the open() methods (which absolutely should not be const).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's an unfortunate result of the following (in read/write methods);

if (debug_) {
    ...
    if (mode_ != 'r') {
        newline_ = true;
        mode_ = 'r';
    }
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all those members are used in if(debug) blocks, so what's the concern here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should be safer and easier to see after my recent commit

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I hadn't realised that mode_ was only used for debugging. That is a peculiar choice. This updated PR makes that much clearer. Thanks.

for better visibility
this stuff should not have imposed non-const-ness on methods
Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12785817025.

Copy link

Private downstream CI failed.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12788838427.

Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12791191179.

1 similar comment
Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12791191179.

Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12791948030.

1 similar comment
Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12791948030.

Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12792221796.

1 similar comment
Copy link

Private downstream CI succeeded.
Workflow name: private-downstream-ci
View the logs at https://github.com/ecmwf-actions/private-downstream-ci/actions/runs/12792221796.

@simondsmart simondsmart merged commit e1b151b into develop Jan 16, 2025
221 of 223 checks passed
@simondsmart simondsmart deleted the fix/TCPSocket-constness branch January 16, 2025 09:48
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