Allow the decoder to fail

This commit is contained in:
Paul Hollinsky
2018-10-18 14:06:58 -04:00
parent e5f1ba41b5
commit dd99f82324
7 changed files with 45 additions and 30 deletions
+4 -1
View File
@@ -102,7 +102,10 @@ void MultiChannelCommunication::readTask() {
if(packetizer->input(payloadBytes)) {
for(auto& packet : packetizer->output()) {
auto msg = decoder->decodePacket(packet);
std::shared_ptr<Message> msg;
if(!decoder->decode(msg, packet))
continue; // TODO Report an error to the user, we failed to decode this packet
for(auto& cb : messageCallbacks) { // We might have closed while reading or processing
if(!closing) {
cb.second.callIfMatch(msg);