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

[core][MAINT] Removed unused and swelling m_pAcceptSockets field + refax #1740

Merged
merged 4 commits into from
Jan 15, 2021

Conversation

ethouris
Copy link
Collaborator

@ethouris ethouris commented Jan 13, 2021

Fixes #1734

The m_pAcceptSocket field seems to not be used for anything. Sockets were added to it and removed from it under some circumstances, but that's about all.

Refax: Also the m_pQueuedSockets field has been turned into m_QueuedSockets and turned into a solid object instead of pointer. There has never been any reason to make this object dynamically allocated and deallocated and it has only increased entropy.

@ethouris ethouris added [core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code labels Jan 13, 2021
@ethouris ethouris added this to the v1.4.3 milestone Jan 13, 2021
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 also voting for making m_QueuedSockets a vector instead of a set.
Only erase operation makes use of a set, but I assume the number of queued sockets is limited by a backlog value, so it is not something where such optimization is beneficial.

srtcore/api.cpp Outdated
Comment on lines 1117 to 1118
u = *(ls->m_QueuedSockets.begin());
ls->m_QueuedSockets.erase(ls->m_QueuedSockets.begin());
Copy link
Collaborator

@maxsharabayko maxsharabayko Jan 14, 2021

Choose a reason for hiding this comment

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

According to the suggestion in comments above the code:

set<SRTSOCKET>::iterator b = ls->m_QueuedSockets.begin();
u = *b;
ls->m_QueuedSockets.erase(b);

@maxsharabayko maxsharabayko merged commit 8b4c8cd into Haivision:master Jan 15, 2021
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.

[BUG] The CUDTSocket::m_pAcceptSockets grows indefinitely
2 participants