Skip to content

Commit

Permalink
common ea3156f: EDI input: Do not print sequence error on first packet
Browse files Browse the repository at this point in the history
  • Loading branch information
mpbraendli committed Oct 28, 2020
1 parent 04e1872 commit 844532b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/edi/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,15 @@ decode_state_t TagDispatcher::decode_afpacket(
}

// SEQ wraps at 0xFFFF, unsigned integer overflow is intentional
const uint16_t expected_seq = m_last_seq + 1;
if (expected_seq != seq) {
etiLog.level(warn) << "EDI AF Packet sequence error, " << seq;
if (m_last_seq_valid) {
const uint16_t expected_seq = m_last_seq + 1;
if (expected_seq != seq) {
etiLog.level(warn) << "EDI AF Packet sequence error, " << seq;
}
}
else {
etiLog.level(info) << "EDI AF Packet initial sequence number: " << seq;
m_last_seq_valid = true;
}
m_last_seq = seq;

Expand Down
1 change: 1 addition & 0 deletions lib/edi/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class TagDispatcher {
bool decode_tagpacket(const std::vector<uint8_t> &payload);

PFT::PFT m_pft;
bool m_last_seq_valid = false;
uint16_t m_last_seq = 0;
std::vector<uint8_t> m_input_data;
std::map<std::string, tag_handler> m_handlers;
Expand Down

0 comments on commit 844532b

Please sign in to comment.