lexus2k / tinyproto

Tiny Software Protocol for communication over UART, SPI, etc
GNU General Public License v3.0
225 stars 51 forks source link

fix(tiny_fd): assert disconnection on (re-)connection request of a co… #38

Open chenlijun99 opened 2 years ago

chenlijun99 commented 2 years ago

This may happen for example if the peer was reset and right after boot it sends the SABM or SNRM frame. If the startup time of the peer is short (in the worst case it is enough that the startup time is less than the keep-alive timeout), it is possible that the primary has not detected the disconnection of peer yet.

Fixes #36

lexus2k commented 1 year ago

I'm sorry for so very long delay. The fix confused me that it doesn't take into account all possible states, when communication is considered active. It seems that DISCONNECTING state should be also use this new branch. I need to test it

chenlijun99 commented 1 year ago

Thanks for the reply. Honestly, I think I should have included some unit tests, but the existing testing fixtures are rather unfamiliar to me. If you are so kind to test and validate this patch, that would be awesome! Alternatively, I'll take some time to add the tests, but I can't promise anything in terms of time.

chenlijun99 commented 1 year ago

BTW

It seems that DISCONNECTING state should be also use this new branch.

Seems reasonable to me.