mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
add logging; cleanup
I'm chasing a relay problem that's hard to repro and need more info when it's happened. (These won't show up in shipping builds.)
This commit is contained in:
parent
a7acc37395
commit
d10d2597d4
6 changed files with 20 additions and 14 deletions
|
@ -140,6 +140,7 @@ public class GameListGroup extends ExpiringLinearLayout
|
|||
//////////////////////////////////////////////////
|
||||
// View.OnLongClickListener interface
|
||||
//////////////////////////////////////////////////
|
||||
@Override
|
||||
public boolean onLongClick( View view )
|
||||
{
|
||||
boolean handled = ! XWApp.CONTEXT_MENUS_ENABLED;
|
||||
|
@ -152,10 +153,10 @@ public class GameListGroup extends ExpiringLinearLayout
|
|||
//////////////////////////////////////////////////
|
||||
// View.OnClickListener interface
|
||||
//////////////////////////////////////////////////
|
||||
@Override
|
||||
public void onClick( View view )
|
||||
{
|
||||
int id = view.getId();
|
||||
switch ( id ) {
|
||||
switch ( view.getId() ) {
|
||||
case R.id.group_check:
|
||||
toggleSelected();
|
||||
break;
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.eehouse.android.xw4.jni;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import org.eehouse.android.xw4.Assert;
|
||||
import org.eehouse.android.xw4.Log;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
|
||||
|
||||
|
@ -104,6 +104,7 @@ public class UtilCtxtImpl implements UtilCtxt {
|
|||
public void setIsServer( boolean isServer )
|
||||
{
|
||||
subclassOverride( "setIsServer" );
|
||||
Assert.failDbg();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1026,21 +1026,21 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getInfo
|
|||
( JNIEnv* env, jclass C, jlong jniGlobalPtr, jlong dictPtr,
|
||||
jboolean check )
|
||||
{
|
||||
jobject result = NULL;
|
||||
jobject jinfo = NULL;
|
||||
#ifdef MAP_THREAD_TO_ENV
|
||||
JNIGlobalState* globalState = (JNIGlobalState*)jniGlobalPtr;
|
||||
MAP_THREAD( &globalState->ti, env );
|
||||
#endif
|
||||
DictionaryCtxt* dict = (DictionaryCtxt*)dictPtr;
|
||||
if ( NULL != dict ) {
|
||||
result = makeObjectEmptyConst( env, PKG_PATH("jni/DictInfo") );
|
||||
jinfo = makeObjectEmptyConst( env, PKG_PATH("jni/DictInfo") );
|
||||
XP_LangCode code = dict_getLangCode( dict );
|
||||
setInt( env, result, "langCode", code );
|
||||
setInt( env, result, "wordCount", dict_getWordCount( dict, env ) );
|
||||
setString( env, result, "md5Sum", dict_getMd5Sum( dict ) );
|
||||
setInt( env, jinfo, "langCode", code );
|
||||
setInt( env, jinfo, "wordCount", dict_getWordCount( dict, env ) );
|
||||
setString( env, jinfo, "md5Sum", dict_getMd5Sum( dict ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
return jinfo;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
|
|
|
@ -693,6 +693,7 @@ comms_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream, XW_UtilCtxt* uti
|
|||
}
|
||||
if ( addr_hasType(&addr, COMMS_CONN_RELAY ) ) {
|
||||
comms->rr.myHostID = stream_getU8( stream );
|
||||
XP_LOGFF( "loaded myHostID: %d", comms->rr.myHostID );
|
||||
stringFromStreamHere( stream, comms->rr.connName,
|
||||
sizeof(comms->rr.connName) );
|
||||
}
|
||||
|
@ -920,6 +921,7 @@ comms_writeToStream( CommsCtxt* comms, XWEnv XP_UNUSED_DBG(xwe),
|
|||
stream_putU32( stream, comms->nextResend );
|
||||
if ( addr_hasType( &comms->addr, COMMS_CONN_RELAY ) ) {
|
||||
stream_putU8( stream, comms->rr.myHostID );
|
||||
XP_LOGFF( "stored myHostID: %d", comms->rr.myHostID );
|
||||
stringToStream( stream, comms->rr.connName );
|
||||
}
|
||||
|
||||
|
@ -1747,12 +1749,14 @@ static void
|
|||
got_connect_cmd( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream,
|
||||
XP_Bool reconnected )
|
||||
{
|
||||
LOG_FUNC();
|
||||
XP_U16 nHere, nSought;
|
||||
XP_Bool isServer;
|
||||
|
||||
set_relay_state( comms, xwe, reconnected ? COMMS_RELAYSTATE_RECONNECTED
|
||||
: COMMS_RELAYSTATE_CONNECTED );
|
||||
XWHostID myHostID = stream_getU8( stream );
|
||||
XP_LOGFF( "myHostID: %d", myHostID );
|
||||
if ( comms->rr.myHostID != myHostID ) {
|
||||
XP_LOGF( "%s: changing rr.myHostID from %x to %x", __func__,
|
||||
comms->rr.myHostID, myHostID );
|
||||
|
@ -1815,7 +1819,7 @@ got_connect_cmd( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream,
|
|||
(*comms->procs.rconnd)( xwe, comms->procs.closure,
|
||||
comms->addr.u.ip_relay.invite, reconnected,
|
||||
comms->rr.myHostID, XP_FALSE, nSought - nHere );
|
||||
XP_LOGF( "%s: have %d of %d players", __func__, nHere, nSought );
|
||||
XP_LOGFF( "have %d of %d players", nHere, nSought );
|
||||
}
|
||||
setHeartbeatTimer( comms );
|
||||
} /* got_connect_cmd */
|
||||
|
@ -3160,8 +3164,7 @@ relay_msg_to_stream( CommsCtxt* comms, XWEnv xwe, XWRELAY_Cmd cmd, XWHostID dest
|
|||
stream_putU8( stream, comms->rr.myHostID );
|
||||
XP_ASSERT( 0 < destID );
|
||||
stream_putU8( stream, destID );
|
||||
XP_LOGF( "%s: wrote ids src %d, dest %d", __func__,
|
||||
comms->rr.myHostID, destID );
|
||||
XP_LOGFF( "wrote ids src %d, dest %d", comms->rr.myHostID, destID );
|
||||
if ( data != NULL && datalen > 0 ) {
|
||||
stream_putBytes( stream, data, datalen );
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ makeGameID( XW_UtilCtxt* util )
|
|||
/* High bit never set by XP_RANDOM() alone */
|
||||
gameID = (XP_RANDOM() << 16) ^ XP_RANDOM();
|
||||
}
|
||||
LOG_RETURNF( "%x", gameID );
|
||||
LOG_RETURNF( "%x/%d", gameID, gameID );
|
||||
return gameID;
|
||||
}
|
||||
|
||||
|
|
|
@ -696,7 +696,8 @@ XP_Bool
|
|||
server_initClientConnection( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
|
||||
{
|
||||
XP_Bool result;
|
||||
LOG_FUNC();
|
||||
XP_LOGFF( "gameState: %s; gameID: %d", getStateStr(server->nv.gameState),
|
||||
server->vol.gi->gameID );
|
||||
CurGameInfo* gi = server->vol.gi;
|
||||
XP_U16 nPlayers;
|
||||
LocalPlayer* lp;
|
||||
|
|
Loading…
Reference in a new issue