Works around weird initial rules for H5 state machine (initial ack must be 0?)
This commit is contained in:
parent
7597c384e8
commit
70c7a8f590
12
src/main.c
12
src/main.c
|
@ -140,6 +140,7 @@ static struct h5 {
|
|||
PAYLOAD,
|
||||
END,
|
||||
} rx_state;
|
||||
bool initializing;
|
||||
} h5;
|
||||
|
||||
//static u8_t unack_queue_len;
|
||||
|
@ -547,7 +548,13 @@ static void unproc_thread(void) {
|
|||
LOG_DBG("Header: seq %d, ack %d, rel: %s, has_crc16: %s", hdr.seq, hdr.ack,
|
||||
hdr.is_reliable ? "true" : "false",
|
||||
hdr.crc_after_payload ? "true" : "false");
|
||||
u8_t expected_seq = next_seq(h5.last_seen_seq_from_host);
|
||||
u8_t expected_seq;
|
||||
if (h5.initializing) {
|
||||
expected_seq = 0;
|
||||
h5.initializing = false;
|
||||
} else {
|
||||
expected_seq = next_seq(h5.last_seen_seq_from_host);
|
||||
}
|
||||
if (hdr.seq != expected_seq) {
|
||||
LOG_ERR("Seq expected %u got %u. Drop packet", expected_seq, hdr.seq);
|
||||
goto next;
|
||||
|
@ -882,8 +889,9 @@ static linkstate_t do_init(struct net_buf const *buf) {
|
|||
return INIT;
|
||||
case H5_CONFIG_RESPONSE:
|
||||
h5.tx_win = conf_rsp[2] & 0x7;
|
||||
h5.last_seen_seq_from_host = 7;
|
||||
h5.last_seen_seq_from_host = 0;
|
||||
h5.local_seq = 0;
|
||||
h5.initializing = true;
|
||||
LOG_DBG("Finished H5 configuration, tx_win %u: INIT -> ACTIVE", h5.tx_win);
|
||||
return ACTIVE;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue