From e9265b1d0129e56b9b665019697055bd63229fde Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 10 Jul 2021 21:04:49 +0100 Subject: Symmetry in MultiVersionProtocol to fix a crash (#5261) + Add HandleOutgoingData, which tests for m_Protocol before calling DataPrepared. * Change std::function to bool + if/else to handle incoming data; it's almost certainly faster. * Fixes #5260 --- src/ClientHandle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 47bbe691a..9dc112011 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -241,7 +241,7 @@ void cClientHandle::ProcessProtocolOut() // to prevent it being reset between the null check and the Send: if (auto Link = m_Link; Link != nullptr) { - m_Protocol->DataPrepared(OutgoingData); + m_Protocol.HandleOutgoingData(OutgoingData); Link->Send(OutgoingData.data(), OutgoingData.size()); } } @@ -3308,7 +3308,7 @@ void cClientHandle::ProcessProtocolIn(void) try { - m_Protocol.HandleIncomingData(*this, std::move(IncomingData)); + m_Protocol.HandleIncomingData(*this, IncomingData); } catch (const std::exception & Oops) { -- cgit v1.2.3