mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
cleanup: logging and method rename
This commit is contained in:
parent
cf3d3bc156
commit
43b979ff46
6 changed files with 18 additions and 7 deletions
|
@ -421,6 +421,7 @@ public class DlgDelegate {
|
|||
|
||||
public void doSyncMenuitem()
|
||||
{
|
||||
Log.d( TAG, "doSyncMenuitem()" );
|
||||
if ( null == DBUtils.getRelayIDs( m_activity, null ) ) {
|
||||
makeOkOnlyBuilder( R.string.no_games_to_refresh ).show();
|
||||
} else {
|
||||
|
|
|
@ -1066,7 +1066,7 @@ public class GameUtils {
|
|||
}
|
||||
|
||||
if ( null != sink ) {
|
||||
JNIThread.tryConnectClient( gamePtr, gi );
|
||||
JNIThread.tryConnect( gamePtr, gi );
|
||||
}
|
||||
|
||||
saveGame( context, gamePtr, gi, lock, false );
|
||||
|
|
|
@ -108,8 +108,8 @@ public class MultiMsgSink implements TransportProcs {
|
|||
Assert.fail();
|
||||
break;
|
||||
}
|
||||
Log.i( TAG, "transportSend(): sent %d via %s",
|
||||
nSent, typ.toString() );
|
||||
Log.i( TAG, "transportSend(): sent %d msgs for game %d/%x via %s",
|
||||
nSent, gameID, gameID, typ.toString() );
|
||||
if ( 0 < nSent ) {
|
||||
Log.d( TAG, "transportSend: adding %s", msgNo );
|
||||
m_sentSet.add( msgNo );
|
||||
|
|
|
@ -559,7 +559,7 @@ public class RelayService extends JobIntentService
|
|||
private static boolean skipNativeSend()
|
||||
{
|
||||
boolean skip = sNativeFailScore.get() > UDP_FAIL_LIMIT || sSkipUPDSet;
|
||||
// Log.d( TAG, "skipNativeSend(score=%d)) => %b", m_nativeFailScore, skip );
|
||||
// Log.d( TAG, "skipNativeSend(score=%d)) => %b", sNativeFailScore.get(), skip );
|
||||
return skip;
|
||||
}
|
||||
|
||||
|
@ -1201,6 +1201,7 @@ public class RelayService extends JobIntentService
|
|||
int sentLen = 0;
|
||||
|
||||
if ( packets.size() > 0 ) {
|
||||
Log.d( TAG, "sendViaUDP(): sending %d at once", packets.size() );
|
||||
final RelayService service = getService();
|
||||
service.noteSent( packets, true );
|
||||
for ( PacketData packet : packets ) {
|
||||
|
@ -1241,6 +1242,7 @@ public class RelayService extends JobIntentService
|
|||
sentLen > 0 );
|
||||
}
|
||||
|
||||
Log.d( TAG, "sendViaUDP(): sent %d bytes", sentLen );
|
||||
return sentLen;
|
||||
}
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ public class JNIThread extends Thread {
|
|||
XwJNI.comms_resetSame( m_jniGamePtr );
|
||||
// FALLTHRU
|
||||
case CMD_START:
|
||||
draw = tryConnectClient( m_jniGamePtr, m_gi );
|
||||
draw = tryConnect( m_jniGamePtr, m_gi );
|
||||
break;
|
||||
|
||||
case CMD_SWITCHCLIENT:
|
||||
|
@ -776,8 +776,9 @@ public class JNIThread extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean tryConnectClient( GamePtr gamePtr, CurGameInfo gi )
|
||||
public static boolean tryConnect( GamePtr gamePtr, CurGameInfo gi )
|
||||
{
|
||||
Log.d( TAG, "tryConnect(rowid=%d)", gamePtr.getRowid() );
|
||||
XwJNI.comms_start( gamePtr );
|
||||
if ( gi.serverRole == DeviceRole.SERVER_ISCLIENT ) {
|
||||
XwJNI.server_initClientConnection( gamePtr );
|
||||
|
|
|
@ -38,10 +38,13 @@ public class XwJNI {
|
|||
private int m_ptr = 0;
|
||||
private int m_refCount = 0;
|
||||
private long m_rowid;
|
||||
private String mStack;
|
||||
|
||||
private GamePtr( int ptr, long rowid ) {
|
||||
private GamePtr( int ptr, long rowid )
|
||||
{
|
||||
m_ptr = ptr;
|
||||
m_rowid = rowid;
|
||||
mStack = android.util.Log.getStackTraceString(new Exception());
|
||||
}
|
||||
|
||||
public synchronized int ptr()
|
||||
|
@ -81,6 +84,10 @@ public class XwJNI {
|
|||
// @Override
|
||||
public void finalize() throws java.lang.Throwable
|
||||
{
|
||||
if ( 0 != m_ptr ) {
|
||||
Log.e( TAG, "ptr not cleared; creator: %s", mStack );
|
||||
}
|
||||
Assert.assertTrue( 0 == m_refCount );
|
||||
Assert.assertTrue( 0 == m_ptr );
|
||||
super.finalize();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue