Merge branch 'vivian/mp'
This commit is contained in:
commit
7563ece882
1 changed files with 13 additions and 13 deletions
|
@ -383,7 +383,7 @@ FGMultiplayMgr::init (void)
|
||||||
mServer.set(txAddress.c_str(), txPort);
|
mServer.set(txAddress.c_str(), txPort);
|
||||||
if (strncmp (mServer.getHost(), "0.0.0.0", 8) == 0) {
|
if (strncmp (mServer.getHost(), "0.0.0.0", 8) == 0) {
|
||||||
mHaveServer = false;
|
mHaveServer = false;
|
||||||
SG_LOG(SG_NETWORK, SG_ALERT,
|
SG_LOG(SG_NETWORK, SG_DEBUG,
|
||||||
"FGMultiplayMgr - could not resolve '"
|
"FGMultiplayMgr - could not resolve '"
|
||||||
<< txAddress << "', Multiplayermode disabled");
|
<< txAddress << "', Multiplayermode disabled");
|
||||||
} else {
|
} else {
|
||||||
|
@ -393,7 +393,7 @@ FGMultiplayMgr::init (void)
|
||||||
rxPort = txPort;
|
rxPort = txPort;
|
||||||
}
|
}
|
||||||
if (rxPort <= 0) {
|
if (rxPort <= 0) {
|
||||||
SG_LOG(SG_NETWORK, SG_ALERT,
|
SG_LOG(SG_NETWORK, SG_DEBUG,
|
||||||
"FGMultiplayMgr - No receiver port, Multiplayermode disabled");
|
"FGMultiplayMgr - No receiver port, Multiplayermode disabled");
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
@ -408,14 +408,14 @@ FGMultiplayMgr::init (void)
|
||||||
// A memory leak was reported here by valgrind
|
// A memory leak was reported here by valgrind
|
||||||
mSocket = new netSocket();
|
mSocket = new netSocket();
|
||||||
if (!mSocket->open(false)) {
|
if (!mSocket->open(false)) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT,
|
SG_LOG( SG_NETWORK, SG_DEBUG,
|
||||||
"FGMultiplayMgr::init - Failed to create data socket" );
|
"FGMultiplayMgr::init - Failed to create data socket" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mSocket->setBlocking(false);
|
mSocket->setBlocking(false);
|
||||||
if (mSocket->bind(rxAddress.c_str(), rxPort) != 0) {
|
if (mSocket->bind(rxAddress.c_str(), rxPort) != 0) {
|
||||||
perror("bind");
|
perror("bind");
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT,
|
SG_LOG( SG_NETWORK, SG_DEBUG,
|
||||||
"FGMultiplayMgr::Open - Failed to bind receive socket" );
|
"FGMultiplayMgr::Open - Failed to bind receive socket" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
||||||
if ((! mInitialised) || (! mHaveServer))
|
if ((! mInitialised) || (! mHaveServer))
|
||||||
return;
|
return;
|
||||||
if (! mHaveServer) {
|
if (! mHaveServer) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::SendMyPosition - no server");
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::SendMyPosition - no server");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ FGMultiplayMgr::Update(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (bytes <= static_cast<ssize_t>(sizeof(T_MsgHdr))) {
|
if (bytes <= static_cast<ssize_t>(sizeof(T_MsgHdr))) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "received message with insufficient data" );
|
<< "received message with insufficient data" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -752,17 +752,17 @@ FGMultiplayMgr::Update(void)
|
||||||
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_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "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_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "message has invalid protocoll number!" );
|
<< "message has invalid protocoll number!" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (MsgHdr->MsgLen != bytes) {
|
if (MsgHdr->MsgLen != bytes) {
|
||||||
SG_LOG(SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "message from " << MsgHdr->Callsign << " has invalid length!");
|
<< "message from " << MsgHdr->Callsign << " has invalid length!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ FGMultiplayMgr::Update(void)
|
||||||
case OLD_POS_DATA_ID:
|
case OLD_POS_DATA_ID:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "Unknown message Id received: " << MsgHdr->MsgId );
|
<< "Unknown message Id received: " << MsgHdr->MsgId );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
||||||
{
|
{
|
||||||
const T_MsgHdr* MsgHdr = Msg.msgHdr();
|
const T_MsgHdr* MsgHdr = Msg.msgHdr();
|
||||||
if (MsgHdr->MsgLen < sizeof(T_MsgHdr) + sizeof(T_PositionMsg)) {
|
if (MsgHdr->MsgLen < sizeof(T_MsgHdr) + sizeof(T_PositionMsg)) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "Position message received with insufficient data" );
|
<< "Position message received with insufficient data" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -928,7 +928,7 @@ FGMultiplayMgr::ProcessPosMsg(const FGMultiplayMgr::MsgBuf& Msg,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pData->float_value = XDR_decode_float(*xdr);
|
pData->float_value = XDR_decode_float(*xdr);
|
||||||
SG_LOG(SG_NETWORK, SG_ALERT, "Unknown Prop type " << pData->id << " " << pData->type);
|
SG_LOG(SG_NETWORK, SG_DEBUG, "Unknown Prop type " << pData->id << " " << pData->type);
|
||||||
xdr++;
|
xdr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -963,7 +963,7 @@ FGMultiplayMgr::ProcessChatMsg(const MsgBuf& Msg,
|
||||||
{
|
{
|
||||||
const T_MsgHdr* MsgHdr = Msg.msgHdr();
|
const T_MsgHdr* MsgHdr = Msg.msgHdr();
|
||||||
if (MsgHdr->MsgLen < sizeof(T_MsgHdr) + 1) {
|
if (MsgHdr->MsgLen < sizeof(T_MsgHdr) + 1) {
|
||||||
SG_LOG( SG_NETWORK, SG_ALERT, "FGMultiplayMgr::MP_ProcessData - "
|
SG_LOG( SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::MP_ProcessData - "
|
||||||
<< "Chat message received with insufficient data" );
|
<< "Chat message received with insufficient data" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue