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

Improve Socket ID generation to better occupy the valid range #1823

Open
maxsharabayko opened this issue Feb 19, 2021 · 0 comments
Open

Improve Socket ID generation to better occupy the valid range #1823

maxsharabayko opened this issue Feb 19, 2021 · 0 comments
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@maxsharabayko
Copy link
Collaborator

CUDTUnited::generateSocketID(..) uses the same m_SocketIDGenerator variable both for a single socket and a group socket ID generation.
It means that generating a single socket value e.g. 100, decrements m_SocketIDGenerator by one. The resulting Socket ID value is 100.
Next generating a group socket ID again decrements the value of m_SocketIDGenerator by one. The resulting Group Socket ID value is 99 | GROUP_MASK.
Generating next Socket ID produces the value 98, skipping value 98.
When m_SocketIDGenerator reaches its initial value of 100 (saved in m_SocketIDGenerator_init, no more sockets are generated with the default procedure.
However, some SocketIDs are still available.

So we get into checking iterating over occupied socket IDs in the loop under if (m_SocketIDGenerator_init == 0). From now on any new socket ID generation goes though this loop.

Using a separate m_GroupSocketIDGenerator variable could save some time before going into this procedure.

Also a check whether all Socket IDs are occupied: m_Sockets.size() and m_Groups.size() could be added.

SRT Version: v1.4.2,

@maxsharabayko maxsharabayko added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels Feb 19, 2021
@maxsharabayko maxsharabayko added this to the Parking Lot milestone Dec 1, 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: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant