From b3fdcecaf45da1b5d611c137037a8c102a07bf99 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 1 Feb 2012 18:42:30 -0800 Subject: [PATCH] send result (failure) for SEND even if there's an exception --- .../src/org/eehouse/android/xw4/BTService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index f811f7ba2..ec98c23c5 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -387,6 +387,7 @@ public class BTService extends Service { private void sendMsg( BTQueueElem elem ) { + boolean success = false; try { BluetoothDevice dev = m_adapter.getRemoteDevice( elem.m_addr ); BluetoothSocket socket = @@ -406,17 +407,18 @@ public class BTService extends Service { DataInputStream inStream = new DataInputStream( socket.getInputStream() ); - boolean success = + success = BTCmd.MESG_ACCPT == BTCmd.values()[inStream.readByte()]; socket.close(); - - BTEvent evt = success ? BTEvent.MESSAGE_ACCEPTED - : BTEvent.MESSAGE_REFUSED; - sendResult( evt, elem.m_gameID, 0, elem.m_recipient ); } } catch ( java.io.IOException ioe ) { DbgUtils.logf( "sendInvites: ioe: %s", ioe.toString() ); + success = false; } + + BTEvent evt = success ? BTEvent.MESSAGE_ACCEPTED + : BTEvent.MESSAGE_REFUSED; + sendResult( evt, elem.m_gameID, 0, elem.m_recipient ); } private void addAddr( BluetoothSocket socket )