1
0
Fork 0

Mutiplayer: increase log level for potential problems;

This is partly experimental to see how often these occur; but also errors in MP packets should be more visible to the developer.
This commit is contained in:
Richard Harrison 2019-07-29 12:53:14 +02:00
parent d71f8daa86
commit e8a50475ec

View file

@ -1753,7 +1753,7 @@ FGMultiplayMgr::update(double dt)
if (::WSAGetLastError() != WSAEWOULDBLOCK) // this is normal on a receive when there is no data if (::WSAGetLastError() != WSAEWOULDBLOCK) // this is normal on a receive when there is no data
{ {
// with Winsock the error will not be the actual problem. // with Winsock the error will not be the actual problem.
SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - Unable to receive data. WSAGetLastError=" << ::WSAGetLastError()); SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - Unable to receive data. WSAGetLastError=" << ::WSAGetLastError());
} }
#else #else
SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - Unable to receive data. " SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - Unable to receive data. "
@ -1765,7 +1765,7 @@ FGMultiplayMgr::update(double dt)
// status is positive: bytes received // status is positive: bytes received
bytes = (ssize_t) RecvStatus; bytes = (ssize_t) RecvStatus;
if (bytes <= static_cast<ssize_t>(sizeof(T_MsgHdr))) { if (bytes <= static_cast<ssize_t>(sizeof(T_MsgHdr))) {
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - " SG_LOG( SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - "
<< "received message with insufficient data" ); << "received message with insufficient data" );
break; break;
} }
@ -1780,20 +1780,24 @@ FGMultiplayMgr::update(double dt)
MsgHdr->ReplyPort = XDR_decode_uint32 (MsgHdr->ReplyPort); MsgHdr->ReplyPort = XDR_decode_uint32 (MsgHdr->ReplyPort);
MsgHdr->Callsign[MAX_CALLSIGN_LEN -1] = '\0'; MsgHdr->Callsign[MAX_CALLSIGN_LEN -1] = '\0';
if (MsgHdr->Magic != MSG_MAGIC) { if (MsgHdr->Magic != MSG_MAGIC) {
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - " SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - "
<< "message has invalid magic number!" ); << "message has invalid magic number!" );
break; break;
} }
if (MsgHdr->Version != PROTO_VER) { if (MsgHdr->Version != PROTO_VER) {
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - " SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - "
<< "message has invalid protocol number!" ); << "message has invalid protocol number!" );
break; break;
} }
if (static_cast<ssize_t>(MsgHdr->MsgLen) != bytes) { if (static_cast<ssize_t>(MsgHdr->MsgLen) != bytes) {
SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - " SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - "
<< "message from " << MsgHdr->Callsign << " has invalid length!"); << "message from " << MsgHdr->Callsign << " has invalid length!");
break; break;
} }
//hexdump the incoming packet
if (pMultiPlayDebugLevel->getIntValue() & 16)
SG_LOG_HEXDUMP(SG_NETWORK, SG_INFO, msgBuf.Msg, MsgHdr->MsgLen);
////////////////////////////////////////////////// //////////////////////////////////////////////////
// Process messages // Process messages
////////////////////////////////////////////////// //////////////////////////////////////////////////
@ -1810,7 +1814,7 @@ FGMultiplayMgr::update(double dt)
case OLD_POS_DATA_ID: case OLD_POS_DATA_ID:
break; break;
default: default:
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - " SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr::MP_ProcessData - "
<< "Unknown message Id received: " << MsgHdr->MsgId ); << "Unknown message Id received: " << MsgHdr->MsgId );
break; break;
} }