send result (failure) for SEND even if there's an exception

This commit is contained in:
Eric House 2012-02-01 18:42:30 -08:00
parent ab32480cd5
commit b3fdcecaf4

View file

@ -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 )