-
Notifications
You must be signed in to change notification settings - Fork 879
[MAINT] Rework queuing functionality around multiplexer and snd/rcv queues #3164
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
Draft
ethouris
wants to merge
6
commits into
Haivision:dev
Choose a base branch
from
ethouris:dev-rework-multiplexer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… to emulate blocking connect
Comment on lines
1635
to
1689
/* | ||
|
||
int srt::CRcvQueue::recvfrom(SRTSOCKET id, CPacket& w_packet) | ||
{ | ||
CUniqueSync buffercond(m_BufferLock, m_BufferCond); | ||
|
||
qmap_t::iterator i = m_mBuffer.find(id); | ||
|
||
if (i == m_mBuffer.end()) | ||
{ | ||
THREAD_PAUSED(); | ||
buffercond.wait_for(seconds_from(1)); | ||
THREAD_RESUMED(); | ||
|
||
i = m_mBuffer.find(id); | ||
if (i == m_mBuffer.end()) | ||
{ | ||
w_packet.setLength(-1); | ||
return -1; | ||
} | ||
} | ||
|
||
// retrieve the earliest packet | ||
CPacket* newpkt = i->second.front(); | ||
|
||
if (w_packet.getLength() < newpkt->getLength()) | ||
{ | ||
w_packet.setLength(-1); | ||
return -1; | ||
} | ||
|
||
// copy packet content | ||
// XXX Check if this wouldn't be better done by providing | ||
// copy constructor for DynamicStruct. | ||
// XXX Another thing: this looks wasteful. This expects an already | ||
// allocated memory on the packet, this thing gets the packet, | ||
// copies it into the passed packet and then the source packet | ||
// gets deleted. Why not simply return the originally stored packet, | ||
// without copying, allocation and deallocation? | ||
memcpy((w_packet.m_nHeader), newpkt->m_nHeader, CPacket::HDR_SIZE); | ||
memcpy((w_packet.m_pcData), newpkt->m_pcData, newpkt->getLength()); | ||
w_packet.setLength(newpkt->getLength()); | ||
w_packet.m_DestAddr = newpkt->m_DestAddr; | ||
|
||
delete newpkt; | ||
|
||
// remove this message from queue, | ||
// if no more messages left for this socket, release its data structure | ||
i->second.pop(); | ||
if (i->second.empty()) | ||
m_mBuffer.erase(i); | ||
|
||
return (int)w_packet.getLength(); | ||
} | ||
*/ |
Check notice
Code scanning / CodeQL
Commented-out code Note
This comment appears to contain commented-out code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The aim of this changeset is to rework the queuing of sent and received packets to allow more flexible send scheduling.
m_SendBlockCond
CV. This CV has been used because it's not used at the time when the connection is not yet established and it corresponds with the rule that the epoll OUT event is used as a signal for connection readiness.srt_sendmsg2
call as the sending time.Further changes embrace: update the tests and testing apps by fixing some problems connected to too early socket closing.