You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python TCP interface.close() blocking until message is sent or arrives #49
Description: calling interface.close() doesn't close the connection until an event arrives on the meshtastic.receive topic regardless of whether we are subscribed to that topic or not. I have worked around this issue by adding an explicit data sent command just before interface.close(). Using sendText is undesirable because I don't want messages to show up for every API open/close so I do: interface.sendData(b'api closing')
just before I call interface.close() and this reliably allows the interface to close every time.
I have also tried explicitly unsubscribing from all topics, but that doesn't have any effect.
The example script is in the forum post, but it's literally just creating a new TCPInterface and then calling close on it with nothing in between.
To Reproduce
Run the python script. The first run of the script will work successfully. Subsequent runs will fail to close in a timely manner. Unblock by sending/receiving a message.
Expectation
Every time I call interface.close(), I shouldn't have to wait any significant amount of time for it to close and it should close regardless of whether there's messages on the message topic.
changed the title [-]Python TCP interface.close() blocking for arbitrary amount of time[/-][+]Python TCP interface.close() blocking until message is sent or arrives[/+]on Jan 2, 2021
Activity
[-]Python TCP interface.close() blocking for arbitrary amount of time[/-][+]Python TCP interface.close() blocking until message is sent or arrives[/+]geeksville commentedon Jan 3, 2021
thanks for the report - I'll work on this todayu.
Fix #49 - force close socket to kill reader thread (was blocking in r…
geeksville commentedon Jan 3, 2021
fixed in 1.1.32 - thanks for the report!