summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 04436070c..5762de897 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -232,6 +232,13 @@ void cClientHandle::ProcessProtocolOut()
decltype(m_OutgoingData) OutgoingData;
{
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);
}
@@ -3318,12 +3325,14 @@ void cClientHandle::ProcessProtocolIn(void)
decltype(m_IncomingData) IncomingData;
{
cCSLock Lock(m_CSIncomingData);
- std::swap(IncomingData, m_IncomingData);
- }
- if (IncomingData.empty())
- {
- return;
+ // Bail out when nothing was received:
+ if (m_IncomingData.empty())
+ {
+ return;
+ }
+
+ std::swap(IncomingData, m_IncomingData);
}
try