mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-08 20:46:12 +01:00
always increment failure count on send failure
This commit is contained in:
parent
b5659f0e5c
commit
276abe6441
1 changed files with 10 additions and 6 deletions
|
@ -736,22 +736,22 @@ public class BTService extends XWJIService {
|
||||||
try {
|
try {
|
||||||
List<PacketAccumulator> pas = getHasData(); // blocks
|
List<PacketAccumulator> pas = getHasData(); // blocks
|
||||||
Thread[] threads = new Thread[pas.size()];
|
Thread[] threads = new Thread[pas.size()];
|
||||||
int ii = 0;
|
for ( int ii = 0; ii < threads.length; ++ii ) {
|
||||||
for ( final PacketAccumulator pa : pas ) {
|
final PacketAccumulator pa = pas.get( ii );
|
||||||
threads[ii] = new Thread( new Runnable() {
|
threads[ii] = new Thread( new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
boolean success = false;
|
||||||
BluetoothSocket socket = null;
|
BluetoothSocket socket = null;
|
||||||
try {
|
try {
|
||||||
boolean success = false;
|
|
||||||
socket = mService.m_adapter.getRemoteDevice( pa.getAddr() )
|
socket = mService.m_adapter.getRemoteDevice( pa.getAddr() )
|
||||||
.createRfcommSocketToServiceRecord( XWApp.getAppUUID() );
|
.createRfcommSocketToServiceRecord( XWApp.getAppUUID() );
|
||||||
DataOutputStream dos = connect( socket );
|
DataOutputStream dos = connect( socket );
|
||||||
if ( null == dos ) {
|
if ( null == dos ) {
|
||||||
pa.setNoHost();
|
pa.setNoHost();
|
||||||
} else {
|
} else {
|
||||||
Log.d( TAG, "%s.run(): connect(%s) => %s", className,
|
Log.d( TAG, "%s.thread.run(): connect(%s) => %s",
|
||||||
pa.getName(), dos );
|
className, pa.getName(), dos );
|
||||||
nDone.addAndGet( pa.writeAndCheck( socket, dos,
|
nDone.addAndGet( pa.writeAndCheck( socket, dos,
|
||||||
mService.mHelper ) );
|
mService.mHelper ) );
|
||||||
success = true;
|
success = true;
|
||||||
|
@ -765,9 +765,12 @@ public class BTService extends XWJIService {
|
||||||
catch (Exception ex) {}
|
catch (Exception ex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( !success ) {
|
||||||
|
pa.setNoHost();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
threads[ii++].start();
|
threads[ii].start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d( TAG, "%s.run(): waiting on %d threads", className,
|
Log.d( TAG, "%s.run(): waiting on %d threads", className,
|
||||||
|
@ -1005,6 +1008,7 @@ public class BTService extends XWJIService {
|
||||||
{
|
{
|
||||||
helper.postEvent( MultiEvent.BAD_PROTO_BT,
|
helper.postEvent( MultiEvent.BAD_PROTO_BT,
|
||||||
socket.getRemoteDevice().getName() );
|
socket.getRemoteDevice().getName() );
|
||||||
|
DbgUtils.printStack( TAG );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatusOut( boolean success )
|
private void updateStatusOut( boolean success )
|
||||||
|
|
Loading…
Add table
Reference in a new issue