improve logging

This commit is contained in:
ehouse 2010-01-28 04:29:24 +00:00
parent 929aea14b0
commit 1ab1806a24
3 changed files with 21 additions and 12 deletions

View file

@ -992,8 +992,10 @@ sendMsg( CommsCtxt* comms, MsgQueueElem* elem )
} else if ( conType == COMMS_CONN_RELAY ) { } else if ( conType == COMMS_CONN_RELAY ) {
if ( comms->r.relayState >= COMMS_RELAYSTATE_CONNECTED ) { if ( comms->r.relayState >= COMMS_RELAYSTATE_CONNECTED ) {
XWHostID destID = getDestID( comms, channelNo ); XWHostID destID = getDestID( comms, channelNo );
result = send_via_relay( comms, XWRELAY_MSG_TORELAY, destID, if ( send_via_relay( comms, XWRELAY_MSG_TORELAY, destID,
elem->msg, elem->len ); elem->msg, elem->len ) ) {
result = elem->len;
}
} else { } else {
XP_LOGF( "%s: skipping message: not connected", __func__ ); XP_LOGF( "%s: skipping message: not connected", __func__ );
} }
@ -1036,12 +1038,12 @@ comms_resendAll( CommsCtxt* comms )
if ( result == 0 && oneResult != 0 ) { if ( result == 0 && oneResult != 0 ) {
result = oneResult; result = oneResult;
} }
XP_STATUSF( "resend: msgID=" XP_LD "; rslt=%d", XP_STATUSF( "%s: msgID=" XP_LD "; rslt=%d", __func__,
msg->msgID, oneResult ); msg->msgID, oneResult );
} }
return result; return result;
} /* comms_resend */ } /* comms_resendAll */
#ifdef XWFEATURE_RELAY #ifdef XWFEATURE_RELAY
# ifdef DEBUG # ifdef DEBUG
@ -1057,6 +1059,7 @@ relayCmdToStr( XWRELAY_Cmd cmd )
CASESTR( XWRELAY_CONNECT_RESP ); CASESTR( XWRELAY_CONNECT_RESP );
CASESTR( XWRELAY_RECONNECT_RESP ); CASESTR( XWRELAY_RECONNECT_RESP );
CASESTR( XWRELAY_ALLHERE ); CASESTR( XWRELAY_ALLHERE );
CASESTR( XWRELAY_ALLBACK );
CASESTR( XWRELAY_DISCONNECT_YOU ); CASESTR( XWRELAY_DISCONNECT_YOU );
CASESTR( XWRELAY_DISCONNECT_OTHER ); CASESTR( XWRELAY_DISCONNECT_OTHER );
CASESTR( XWRELAY_CONNECTDENIED ); CASESTR( XWRELAY_CONNECTDENIED );

View file

@ -2483,7 +2483,7 @@ connEvtAndError( CEAppGlobals* globals, WPARAM wParam )
#endif #endif
LRESULT CALLBACK LRESULT CALLBACK
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) WndProc( HWND hWnd, UINT message, const WPARAM wParam, const LPARAM lParam )
{ {
LRESULT result = 0; LRESULT result = 0;
int wmId; int wmId;
@ -2774,17 +2774,19 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
message==WM_KEYDOWN, &handled ); message==WM_KEYDOWN, &handled );
break; break;
#endif #endif
case WM_CHAR: case WM_CHAR: {
WPARAM tmpWParam = wParam;
if ( wParam == 0x08 ) { if ( wParam == 0x08 ) {
wParam = XP_CURSOR_KEY_DEL; tmpWParam = XP_CURSOR_KEY_DEL;
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
} else if ( wParam == ' ' ) { } else if ( wParam == ' ' ) {
wParam = XP_RAISEFOCUS_KEY; tmpWParam = XP_RAISEFOCUS_KEY;
#endif #endif
} }
draw = board_handleKey( globals->game.board, wParam, &handled ) draw = board_handleKey( globals->game.board, tmpWParam, &handled )
|| board_handleKey( globals->game.board, wParam - ('a'-'A'), || board_handleKey( globals->game.board, tmpWParam - ('a'-'A'),
&handled ); &handled );
}
break; break;
case WM_TIMER: case WM_TIMER:

View file

@ -442,13 +442,13 @@ dispatch_msgs( CeSocketWrapper* self )
XP_U16 msgLen; XP_U16 msgLen;
XP_U16 lenUsed, lenLeft; XP_U16 lenUsed, lenLeft;
XP_LOGF( "%s: have %d bytes", __func__, lenInBuffer );
/* Do we even have the length header? */ /* Do we even have the length header? */
if ( lenInBuffer < sizeof(msgLen) ) { if ( lenInBuffer < sizeof(msgLen) ) {
break; break;
} }
XP_LOGF( "%s: have %d bytes", __func__, lenInBuffer );
XP_MEMCPY( &msgLen, self->in_buf, sizeof(msgLen) ); XP_MEMCPY( &msgLen, self->in_buf, sizeof(msgLen) );
msgLen = XP_NTOHS( msgLen ); msgLen = XP_NTOHS( msgLen );
@ -519,6 +519,8 @@ ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
long event = (long)LOWORD(lParam); long event = (long)LOWORD(lParam);
XP_Bool draw = XP_FALSE; XP_Bool draw = XP_FALSE;
XP_LOGF( "%s(event=%lx)", __func__, event );
if ( 0 != (FD_WRITE & event) ) { if ( 0 != (FD_WRITE & event) ) {
send_packet_if( self ); send_packet_if( self );
event &= ~FD_WRITE; event &= ~FD_WRITE;
@ -547,6 +549,8 @@ ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
} }
if ( 0 != (FD_CLOSE & event) ) { if ( 0 != (FD_CLOSE & event) ) {
int err = WSAGETSELECTERROR(lParam);
XP_LOGF( "%s: got FD_CLOSE; err=%d", __func__, err );
event &= ~FD_CLOSE; event &= ~FD_CLOSE;
closeConnection( self ); closeConnection( self );
} }