adding logging

This commit is contained in:
Eric House 2020-08-24 12:10:25 -07:00
parent 7cb2560b2d
commit a7acc37395
3 changed files with 12 additions and 4 deletions

View file

@ -1831,6 +1831,7 @@ public class BoardDelegate extends DelegateBase
@Override @Override
public void setIsServer( boolean isServer ) public void setIsServer( boolean isServer )
{ {
Log.d( TAG, "setIsServer(isServer=%b)", isServer );
DeviceRole newRole = isServer? DeviceRole.SERVER_ISSERVER DeviceRole newRole = isServer? DeviceRole.SERVER_ISSERVER
: DeviceRole.SERVER_ISCLIENT; : DeviceRole.SERVER_ISCLIENT;
if ( newRole != m_gi.serverRole ) { if ( newRole != m_gi.serverRole ) {
@ -1838,6 +1839,8 @@ public class BoardDelegate extends DelegateBase
if ( !isServer ) { if ( !isServer ) {
handleViaThread( JNICmd.CMD_SWITCHCLIENT ); handleViaThread( JNICmd.CMD_SWITCHCLIENT );
} }
} else {
Log.d( TAG, "setIsServer(): no change" );
} }
} }

View file

@ -1762,7 +1762,7 @@ got_connect_cmd( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream,
isServer = HOST_ID_SERVER == comms->rr.myHostID; isServer = HOST_ID_SERVER == comms->rr.myHostID;
if ( isServer != comms->isServer ) { if ( isServer != comms->isServer ) {
XP_LOGF( "%s: becoming%s a server", __func__, isServer ? "" : " NOT" ); XP_LOGFF( "becoming%s a server", isServer ? "" : " NOT" );
comms->isServer = isServer; comms->isServer = isServer;
util_setIsServer( comms->util, xwe, comms->isServer ); util_setIsServer( comms->util, xwe, comms->isServer );

View file

@ -207,6 +207,8 @@ static void writeProto( const ServerCtxt* server, XWStreamCtxt* stream,
#define PICK_NEXT -1 #define PICK_NEXT -1
#define PICK_CUR -2 #define PICK_CUR -2
#define LOG_GAMEID() XP_LOGFF("gameID: %d", server->vol.gi->gameID )
#if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY #if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY
static char* static char*
getStateStr( XW_State st ) getStateStr( XW_State st )
@ -290,6 +292,7 @@ amServer( const ServerCtxt* server )
static void static void
initServer( ServerCtxt* server, XWEnv xwe ) initServer( ServerCtxt* server, XWEnv xwe )
{ {
LOG_GAMEID();
setTurn( server, xwe, -1 ); /* game isn't under way yet */ setTurn( server, xwe, -1 ); /* game isn't under way yet */
if ( 0 ) { if ( 0 ) {
@ -585,6 +588,7 @@ cleanupServer( ServerCtxt* server, XWEnv xwe )
void void
server_reset( ServerCtxt* server, XWEnv xwe, CommsCtxt* comms ) server_reset( ServerCtxt* server, XWEnv xwe, CommsCtxt* comms )
{ {
LOG_GAMEID();
ServerVolatiles vol = server->vol; ServerVolatiles vol = server->vol;
cleanupServer( server, xwe ); cleanupServer( server, xwe );
@ -744,8 +748,8 @@ server_initClientConnection( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream
#endif #endif
} else { } else {
XP_LOGF( "%s: wierd state: %s (expected XWSTATE_NONE); dropping message", XP_LOGFF( "wierd state: %s (expected XWSTATE_NONE); dropping message",
__func__, getStateStr(server->nv.gameState) ); getStateStr(server->nv.gameState) );
} }
stream_destroy( stream, xwe ); stream_destroy( stream, xwe );
return result; return result;
@ -1612,7 +1616,8 @@ server_do( ServerCtxt* server, XWEnv xwe )
} else { } else {
XP_Bool moreToDo = XP_FALSE; XP_Bool moreToDo = XP_FALSE;
server->serverDoing = XP_TRUE; server->serverDoing = XP_TRUE;
XP_LOGFF( "gameState: %s", getStateStr(server->nv.gameState) ); XP_LOGFF( "gameState: %s; gameID: %d", getStateStr(server->nv.gameState),
server->vol.gi->gameID );
switch( server->nv.gameState ) { switch( server->nv.gameState ) {
case XWSTATE_BEGIN: case XWSTATE_BEGIN:
if ( server->nv.pendingRegistrations == 0 ) { /* all players on if ( server->nv.pendingRegistrations == 0 ) { /* all players on