Open Watayut opened 2 years ago
I was trying to reproduce the issues but I failed. Adding delay from your commit doesn't cause any issues with communication. If you have any automatic script to reproduce the issue, please let me know.
PS. There are 2 branches supported: master branch and cpp_api. Could you please check if cpp_api has the same issue for you?
I found this issue when I ported the library to my target board, then I tried to reproduce this issue with your example code.
My Setup
I created virtual serial port and run 2 tiny_loopbacks example to communicate with each other. With your example I can close one program and restart it without any issue. But after I added couple of delay to generator side, I found the issue.
Virtual Serial port
socat -d -d pty,raw,echo=0 pty,raw,echo=0
Generator side
$TINYPROTO_EXAMPLE_PATH/linux/loopback/tiny_loopback -p /dev/pts/30 -g
Loopback side
$TINYPROTO_EXAMPLE_PATH/linux/loopback/tiny_loopback -p /dev/pts/31
Build
My edited code (tiny_loopback.cpp)
Result of first connection. (Left side is generator / Right side is loopback)
Result of second/third connection. (I close the generator side and restart it) Generator side try to connect and then fail and the this loop happens repeatedly.
Do you have any clue or workaround for this issue? Thanks.