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

[REFAX] Refactored function calls at close socket for preparing a change #2639

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ethouris
Copy link
Collaborator

No description provided.

@ethouris ethouris added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Jan 31, 2023
@maxsharabayko maxsharabayko added this to the v1.5.2 milestone Jan 31, 2023
@maxsharabayko
Copy link
Collaborator

Extracted from #1829.

@ethouris ethouris marked this pull request as draft February 1, 2023 16:00
@ethouris
Copy link
Collaborator Author

ethouris commented Feb 1, 2023

Careful. This last fix has caused tests to crash.

@ethouris
Copy link
Collaborator Author

ethouris commented Feb 3, 2023

Now the refax should be ok, but all attempts to provide a reliable closing a socket have failed, so this refax is useless.

Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

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

I am concerned with this function because it provides not much hints of what it does internally.
It notably comes from the overall mess with socket lifetime management.

There is m_ClosedSockets for sockets to be closed and m_Sockets for active sockets.
A socket can sometimes be present in both lists for a short time.
swipeSocket_LOCKED(i->first, s, SWIPE_LATER) with SWIPE_LATER is only used in checkBrokenSockets(..). All other places use SWIPE_NOW. Does it make sense to have a function that does both?

newConnection error, srt_close, removeSocket -> SWIPE_NOW.
checkBrokenSockets(..), srt_cleanup -> SWIPE_LATER.

@ethouris
Copy link
Collaborator Author

The SWIPE_NOW and SWIPE_LATER differ only with that when SWIPE_LATER is used, then the call will be followed by a loop that will delete all sockets that were collected in the temporary list. So the socket being worked about at this call need not be swiped at this moment.

@maxsharabayko maxsharabayko modified the milestones: v1.5.2, v1.6.0 Feb 10, 2023
Co-authored-by: Maxim Sharabayko <maxlovic@gmail.com>
Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (45232ad) 66.50% compared to head (b5dd5a5) 66.22%.
Report is 126 commits behind head on master.

❗ Current head b5dd5a5 differs from pull request most recent head ed1e8d0. Consider uploading reports for the commit ed1e8d0 to get more accurate results

Files Patch % Lines
srtcore/api.cpp 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2639      +/-   ##
==========================================
- Coverage   66.50%   66.22%   -0.29%     
==========================================
  Files          99       99              
  Lines       19820    19848      +28     
==========================================
- Hits        13182    13144      -38     
- Misses       6638     6704      +66     

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

@maxsharabayko maxsharabayko modified the milestones: v1.5.4, v1.6.0 Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants