prevent the regular protocol parser to parse connection less messages

This commit is contained in:
Volker Fischer 2011-03-27 14:00:58 +00:00
parent 5aa210533b
commit 9903fab723
2 changed files with 17 additions and 1 deletions

View file

@ -335,6 +335,19 @@ bool CProtocol::ParseMessage ( const CVector<uint8_t>& vecbyData,
if ( rand() < ( RAND_MAX / 2 ) ) return false;
*/
// in case this is a connection less message, we do not process it here
if ( IsConnectionLessMessageID ( iRecID ) )
{
// TODO fire signal so that an other class can process this type of message
// return function without issuing an error code (since it is a
// regular message but will just not processed here)
return false;
}
// In case we received a message and returned an answer but our answer
// did not make it to the receiver, he will resend his message. We check
// here if the message is the same as the old one, and if this is the

View file

@ -54,7 +54,7 @@
#define PROTMESSID_REQ_CHANNEL_NAME 23 // request channel name for fader tag
// message IDs of connection less messages (CLM)
// DEFINITION -> start at 1000, end at 1999
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
#define PROTMESSID_CLM_PING_MS 1001 // for measuring ping time
#define PROTMESSID_CLM_SERVER_FULL 1002 // server full message
#define PROTMESSID_CLM_SERVER_LIST 1003 // server list
@ -153,6 +153,9 @@ protected:
unsigned int& iPos,
const unsigned int iNumOfBytes );
bool IsConnectionLessMessageID ( const int iID ) const
{ return (iID >= 1000) & (iID < 2000); }
void SendMessage();
void CreateAndSendMessage ( const int iID, const CVector<uint8_t>& vecData );