Removed extraneous error checking
parent
b7288edd9a
commit
44ca4d4db1
|
|
@ -149,12 +149,11 @@ void Communication::readTask() {
|
||||||
if(packetizer->input(readBytes)) {
|
if(packetizer->input(readBytes)) {
|
||||||
for(auto& packet : packetizer->output()) {
|
for(auto& packet : packetizer->output()) {
|
||||||
std::shared_ptr<Message> msg;
|
std::shared_ptr<Message> msg;
|
||||||
if(!decoder->decode(msg, packet)) {
|
if(!decoder->decode(msg, packet))
|
||||||
err(APIError::Unknown); // TODO Use specific error
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lk(messageCallbacksLock);
|
std::lock_guard<std::mutex> lk(messageCallbacksLock);
|
||||||
|
|
||||||
for(auto& cb : messageCallbacks) {
|
for(auto& cb : messageCallbacks) {
|
||||||
if(!closing) { // We might have closed while reading or processing
|
if(!closing) { // We might have closed while reading or processing
|
||||||
cb.second.callIfMatch(msg);
|
cb.second.callIfMatch(msg);
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,7 @@ bool ICommunication::readWait(std::vector<uint8_t>& bytes, std::chrono::millisec
|
||||||
|
|
||||||
bytes.resize(actuallyRead);
|
bytes.resize(actuallyRead);
|
||||||
|
|
||||||
bool ret = actuallyRead > 0;
|
return actuallyRead > 0;
|
||||||
if(!ret)
|
|
||||||
err(APIError::FailedToRead);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ICommunication::write(const std::vector<uint8_t>& bytes) {
|
bool ICommunication::write(const std::vector<uint8_t>& bytes) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue