shell: Add first version
Avoid a while true loop in the receive thread in case invalid data was received

Now the disconnect function doesn't wait forever for the receive thread to end.