Skip to content

Commit

Permalink
McsService: only send to the output stream if it is alive
Browse files Browse the repository at this point in the history
The output stream handler thread might not be alive, this occurs
reproducibly when connecting fails and a tear down is initiated.
Messages shouldn't be sent when the output handler thread is not alive
(triggers an expection which is catched but logged), this check avoids
this unless some special race condition occurs. Dropping the messages
shouldn't hurt (they were dropped anyway).
  • Loading branch information
michitux committed Jan 17, 2016
1 parent 3636f18 commit 4880946
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private void send(Message message) {

private void sendOutputStream(int what, Object obj) {
McsOutputStream os = outputStream;
if (os != null) {
if (os != null && os.isAlive()) {
Handler outputHandler = os.getHandler();
if (outputHandler != null)
outputHandler.sendMessage(outputHandler.obtainMessage(what, obj));
Expand Down

0 comments on commit 4880946

Please sign in to comment.