channel: fix race condition in sendMsg
channel: fix race condition in sendMsg

sendMsg spawns a goroutine to check for request context cancellation.
If the goroutine detects context cancellation, it causes a reconnection
as a precaution against blocked streams. This was added in 7d8c750 to
prevent a deadlock if the server stops receiving messages.

However, if the caller cancels the context very soon after a message is
sent, then the goroutine could still decide to reconnect the stream even
though there is no need for it. The solution is to double check whether
the message was really sent.

relab/gorums,relab/gorums,relab/gorums