Removed extraneous error checking

This commit is contained in:
EricLiu2000
2019-06-13 16:04:20 -04:00
parent b7288edd9a
commit 44ca4d4db1
2 changed files with 3 additions and 7 deletions
+2 -3
View File
@@ -149,12 +149,11 @@ void Communication::readTask() {
if(packetizer->input(readBytes)) {
for(auto& packet : packetizer->output()) {
std::shared_ptr<Message> msg;
if(!decoder->decode(msg, packet)) {
err(APIError::Unknown); // TODO Use specific error
if(!decoder->decode(msg, packet))
continue;
}
std::lock_guard<std::mutex> lk(messageCallbacksLock);
for(auto& cb : messageCallbacks) {
if(!closing) { // We might have closed while reading or processing
cb.second.callIfMatch(msg);
+1 -4
View File
@@ -35,10 +35,7 @@ bool ICommunication::readWait(std::vector<uint8_t>& 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<uint8_t>& bytes) {