Add functions names to log statements.

This commit is contained in:
ehouse 2009-03-08 19:54:50 +00:00
parent 4e1155583f
commit d7eaa8e574

View file

@ -199,7 +199,7 @@ static void
init_relay( CommsCtxt* comms, XP_U16 nPlayersHere, XP_U16 nPlayersTotal ) init_relay( CommsCtxt* comms, XP_U16 nPlayersHere, XP_U16 nPlayersTotal )
{ {
comms->r.myHostID = comms->isServer? HOST_ID_SERVER: HOST_ID_NONE; comms->r.myHostID = comms->isServer? HOST_ID_SERVER: HOST_ID_NONE;
XP_LOGF( "set myHostID to %d", comms->r.myHostID ); XP_LOGF( "%s: set myHostID to %d", __func__, comms->r.myHostID );
comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED; comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED;
comms->r.nPlayersHere = nPlayersHere; comms->r.nPlayersHere = nPlayersHere;
comms->r.nPlayersTotal = nPlayersTotal; comms->r.nPlayersTotal = nPlayersTotal;
@ -957,7 +957,7 @@ sendMsg( CommsCtxt* comms, MsgQueueElem* elem )
if ( result == elem->len ) { if ( result == elem->len ) {
++elem->sendCount; ++elem->sendCount;
XP_LOGF( "sendCount now %d", elem->sendCount ); XP_LOGF( "%s: sendCount now %d", __func__, elem->sendCount );
} }
return result; return result;
@ -1078,7 +1078,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
consumed = cookieID != comms->r.cookieID consumed = cookieID != comms->r.cookieID
|| destID != comms->r.myHostID; || destID != comms->r.myHostID;
if ( consumed ) { if ( consumed ) {
XP_LOGF( "rejecting data message" ); XP_LOGF( "%s: rejecting data message", __func__ );
} else { } else {
*senderID = srcID; *senderID = srcID;
} }
@ -1087,7 +1087,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
case XWRELAY_DISCONNECT_OTHER: case XWRELAY_DISCONNECT_OTHER:
relayErr = stream_getU8( stream ); relayErr = stream_getU8( stream );
srcID = stream_getU8( stream ); srcID = stream_getU8( stream );
XP_LOGF( "host id %x disconnected", srcID ); XP_LOGF( "%s: host id %x disconnected", __func__, srcID );
/* we will eventually want to tell the user which player's gone */ /* we will eventually want to tell the user which player's gone */
util_userError( comms->util, ERR_RELAY_BASE + relayErr ); util_userError( comms->util, ERR_RELAY_BASE + relayErr );
break; break;
@ -1099,7 +1099,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED; comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED;
/* fallthru */ /* fallthru */
default: default:
XP_LOGF( "dropping relay msg with cmd %d", (XP_U16)cmd ); XP_LOGF( "%s: dropping relay msg with cmd %d", __func__, (XP_U16)cmd );
} }
return consumed; return consumed;
@ -1435,8 +1435,8 @@ heartbeat_checks( CommsCtxt* comms )
XP_U32 now = util_getCurSeconds( comms->util ); XP_U32 now = util_getCurSeconds( comms->util );
XP_U32 tooLongAgo = now - (HB_INTERVAL * 2); XP_U32 tooLongAgo = now - (HB_INTERVAL * 2);
if ( comms->lastMsgRcvdTime < tooLongAgo ) { if ( comms->lastMsgRcvdTime < tooLongAgo ) {
XP_LOGF( "calling reset proc; last was %ld secs too long ago", XP_LOGF( "%s: calling reset proc; last was %ld secs too long "
tooLongAgo - comms->lastMsgRcvdTime ); "ago", __func__, tooLongAgo - comms->lastMsgRcvdTime );
(*comms->resetproc)(comms->sendClosure); (*comms->resetproc)(comms->sendClosure);
comms->lastMsgRcvdTime = 0; comms->lastMsgRcvdTime = 0;
break; /* outta here */ break; /* outta here */
@ -1641,7 +1641,7 @@ getDestID( CommsCtxt* comms, XP_PlayerAddr channelNo )
} }
} }
} }
XP_LOGF( "getDestID(%d) => %x", channelNo, id ); XP_LOGF( "%s(%d) => %x", __func__, channelNo, id );
return id; return id;
} /* getDestID */ } /* getDestID */
@ -1718,7 +1718,7 @@ send_via_relay( CommsCtxt* comms, XWRELAY_Cmd cmd, XWHostID destID,
stream_destroy( tmpStream ); stream_destroy( tmpStream );
if ( buf != NULL ) { if ( buf != NULL ) {
XP_U16 result; XP_U16 result;
XP_LOGF( "passing %d bytes to sendproc", len ); XP_LOGF( "%s: passing %d bytes to sendproc", __func__, len );
result = (*comms->sendproc)( buf, len, &addr, comms->sendClosure ); result = (*comms->sendproc)( buf, len, &addr, comms->sendClosure );
success = result == len; success = result == len;
if ( success ) { if ( success ) {
@ -1785,7 +1785,7 @@ send_via_bt_or_ip( CommsCtxt* comms, BTIPMsgType typ, XP_PlayerAddr channelNo,
static void static void
relayDisconnect( CommsCtxt* comms ) relayDisconnect( CommsCtxt* comms )
{ {
XP_LOGF( "relayDisconnect called" ); LOG_FUNC();
if ( comms->addr.conType == COMMS_CONN_RELAY ) { if ( comms->addr.conType == COMMS_CONN_RELAY ) {
if ( comms->r.relayState != COMMS_RELAYSTATE_UNCONNECTED ) { if ( comms->r.relayState != COMMS_RELAYSTATE_UNCONNECTED ) {
comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED; comms->r.relayState = COMMS_RELAYSTATE_UNCONNECTED;