Do an early check for empty network buffers (#5172)
Avoid overhead when nothing to do.
This commit is contained in:
parent
abcc14076c
commit
8ec5552998
@ -232,6 +232,13 @@ void cClientHandle::ProcessProtocolOut()
|
|||||||
decltype(m_OutgoingData) OutgoingData;
|
decltype(m_OutgoingData) OutgoingData;
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSOutgoingData);
|
cCSLock Lock(m_CSOutgoingData);
|
||||||
|
|
||||||
|
// Bail out when there's nothing to send to avoid TCPLink::Send overhead:
|
||||||
|
if (m_OutgoingData.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::swap(OutgoingData, m_OutgoingData);
|
std::swap(OutgoingData, m_OutgoingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3318,12 +3325,14 @@ void cClientHandle::ProcessProtocolIn(void)
|
|||||||
decltype(m_IncomingData) IncomingData;
|
decltype(m_IncomingData) IncomingData;
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSIncomingData);
|
cCSLock Lock(m_CSIncomingData);
|
||||||
std::swap(IncomingData, m_IncomingData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IncomingData.empty())
|
// Bail out when nothing was received:
|
||||||
{
|
if (m_IncomingData.empty())
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::swap(IncomingData, m_IncomingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user