Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #309
The
ConnectionManager
has a daemon thread which serialises and enacts all connection state changes and notifies listeners. However, there are events that arise from the transport (ie disconnections and errors) that are asynchronous relative to theConnectionManager
; and these can result in the transport being cleared. This means there are windows in which the connection state indicates that messages may be sent, but the transport is unavailable.This change avoids the crashes that occur if there is an attempt to send a message when there is no transport. The messages can be silently discarded, just as if they were sent on a transport but never arrived at the destination. Higher layers (eg the protocol acknowledgements) will take care of the resulting errors/omissions.