shrimpy-python icon indicating copy to clipboard operation
shrimpy-python copied to clipboard

Clearing the is_closed flag in _connect() creates a race condition

Open cwm9cwm9 opened this issue 4 years ago • 0 comments

If the program attempts to call disconnect before _connect() is reached by the new thread created in connect(), is_closed is set before it is cleared and the program never exits.

Also, renamed is_closed to close_requested to make the purpose of the variable more clear.

Samples should be updated to include:

 # Once complete, stop the client
 #add this line \/
 input("Press Enter to exit...")
 #add this line /\
 client.disconnect()

Otherwise, they will exit immediately without printing anything.

cwm9cwm9 avatar Mar 14 '21 00:03 cwm9cwm9