mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-26 09:58:20 +01:00
improve logging
This commit is contained in:
parent
929aea14b0
commit
1ab1806a24
3 changed files with 21 additions and 12 deletions
|
@ -992,8 +992,10 @@ sendMsg( CommsCtxt* comms, MsgQueueElem* elem )
|
|||
} else if ( conType == COMMS_CONN_RELAY ) {
|
||||
if ( comms->r.relayState >= COMMS_RELAYSTATE_CONNECTED ) {
|
||||
XWHostID destID = getDestID( comms, channelNo );
|
||||
result = send_via_relay( comms, XWRELAY_MSG_TORELAY, destID,
|
||||
elem->msg, elem->len );
|
||||
if ( send_via_relay( comms, XWRELAY_MSG_TORELAY, destID,
|
||||
elem->msg, elem->len ) ) {
|
||||
result = elem->len;
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "%s: skipping message: not connected", __func__ );
|
||||
}
|
||||
|
@ -1036,12 +1038,12 @@ comms_resendAll( CommsCtxt* comms )
|
|||
if ( result == 0 && oneResult != 0 ) {
|
||||
result = oneResult;
|
||||
}
|
||||
XP_STATUSF( "resend: msgID=" XP_LD "; rslt=%d",
|
||||
XP_STATUSF( "%s: msgID=" XP_LD "; rslt=%d", __func__,
|
||||
msg->msgID, oneResult );
|
||||
}
|
||||
|
||||
return result;
|
||||
} /* comms_resend */
|
||||
} /* comms_resendAll */
|
||||
|
||||
#ifdef XWFEATURE_RELAY
|
||||
# ifdef DEBUG
|
||||
|
@ -1057,6 +1059,7 @@ relayCmdToStr( XWRELAY_Cmd cmd )
|
|||
CASESTR( XWRELAY_CONNECT_RESP );
|
||||
CASESTR( XWRELAY_RECONNECT_RESP );
|
||||
CASESTR( XWRELAY_ALLHERE );
|
||||
CASESTR( XWRELAY_ALLBACK );
|
||||
CASESTR( XWRELAY_DISCONNECT_YOU );
|
||||
CASESTR( XWRELAY_DISCONNECT_OTHER );
|
||||
CASESTR( XWRELAY_CONNECTDENIED );
|
||||
|
|
|
@ -2483,7 +2483,7 @@ connEvtAndError( CEAppGlobals* globals, WPARAM wParam )
|
|||
#endif
|
||||
|
||||
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;
|
||||
int wmId;
|
||||
|
@ -2774,17 +2774,19 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
message==WM_KEYDOWN, &handled );
|
||||
break;
|
||||
#endif
|
||||
case WM_CHAR:
|
||||
case WM_CHAR: {
|
||||
WPARAM tmpWParam = wParam;
|
||||
if ( wParam == 0x08 ) {
|
||||
wParam = XP_CURSOR_KEY_DEL;
|
||||
tmpWParam = XP_CURSOR_KEY_DEL;
|
||||
#ifdef KEYBOARD_NAV
|
||||
} else if ( wParam == ' ' ) {
|
||||
wParam = XP_RAISEFOCUS_KEY;
|
||||
tmpWParam = XP_RAISEFOCUS_KEY;
|
||||
#endif
|
||||
}
|
||||
draw = board_handleKey( globals->game.board, wParam, &handled )
|
||||
|| board_handleKey( globals->game.board, wParam - ('a'-'A'),
|
||||
draw = board_handleKey( globals->game.board, tmpWParam, &handled )
|
||||
|| board_handleKey( globals->game.board, tmpWParam - ('a'-'A'),
|
||||
&handled );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
|
|
|
@ -442,13 +442,13 @@ dispatch_msgs( CeSocketWrapper* self )
|
|||
XP_U16 msgLen;
|
||||
XP_U16 lenUsed, lenLeft;
|
||||
|
||||
XP_LOGF( "%s: have %d bytes", __func__, lenInBuffer );
|
||||
|
||||
/* Do we even have the length header? */
|
||||
if ( lenInBuffer < sizeof(msgLen) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
XP_LOGF( "%s: have %d bytes", __func__, lenInBuffer );
|
||||
|
||||
XP_MEMCPY( &msgLen, self->in_buf, sizeof(msgLen) );
|
||||
msgLen = XP_NTOHS( msgLen );
|
||||
|
||||
|
@ -519,6 +519,8 @@ ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
|
|||
long event = (long)LOWORD(lParam);
|
||||
XP_Bool draw = XP_FALSE;
|
||||
|
||||
XP_LOGF( "%s(event=%lx)", __func__, event );
|
||||
|
||||
if ( 0 != (FD_WRITE & event) ) {
|
||||
send_packet_if( self );
|
||||
event &= ~FD_WRITE;
|
||||
|
@ -547,6 +549,8 @@ ce_sockwrap_event( CeSocketWrapper* self, WPARAM wParam, LPARAM lParam )
|
|||
}
|
||||
|
||||
if ( 0 != (FD_CLOSE & event) ) {
|
||||
int err = WSAGETSELECTERROR(lParam);
|
||||
XP_LOGF( "%s: got FD_CLOSE; err=%d", __func__, err );
|
||||
event &= ~FD_CLOSE;
|
||||
closeConnection( self );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue