From 44ca4d4db14d393ab3b384d3d75a0fcf2c425245 Mon Sep 17 00:00:00 2001 From: EricLiu2000 Date: Thu, 13 Jun 2019 16:00:59 -0400 Subject: [PATCH] Removed extraneous error checking --- communication/communication.cpp | 5 ++--- communication/icommunication.cpp | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/communication/communication.cpp b/communication/communication.cpp index 1f5a01b..bfc8521 100644 --- a/communication/communication.cpp +++ b/communication/communication.cpp @@ -149,12 +149,11 @@ void Communication::readTask() { if(packetizer->input(readBytes)) { for(auto& packet : packetizer->output()) { std::shared_ptr msg; - if(!decoder->decode(msg, packet)) { - err(APIError::Unknown); // TODO Use specific error + if(!decoder->decode(msg, packet)) continue; - } std::lock_guard lk(messageCallbacksLock); + for(auto& cb : messageCallbacks) { if(!closing) { // We might have closed while reading or processing cb.second.callIfMatch(msg); diff --git a/communication/icommunication.cpp b/communication/icommunication.cpp index 91b4ad7..93e7741 100644 --- a/communication/icommunication.cpp +++ b/communication/icommunication.cpp @@ -35,10 +35,7 @@ bool ICommunication::readWait(std::vector& bytes, std::chrono::millisec bytes.resize(actuallyRead); - bool ret = actuallyRead > 0; - if(!ret) - err(APIError::FailedToRead); - return ret; + return actuallyRead > 0; } bool ICommunication::write(const std::vector& bytes) {