do not start server when protocol message is received
This commit is contained in:
parent
cff359cbaf
commit
5c42d81137
2 changed files with 13 additions and 9 deletions
|
@ -96,7 +96,7 @@ bool CChannelSet::PutData ( const CVector<unsigned char>& vecbyRecBuf,
|
||||||
const int iNumBytesRead,
|
const int iNumBytesRead,
|
||||||
const CHostAddress& HostAdr )
|
const CHostAddress& HostAdr )
|
||||||
{
|
{
|
||||||
bool bChanOK = true;
|
bool bChanOK = false;
|
||||||
|
|
||||||
Mutex.lock ();
|
Mutex.lock ();
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ bool CChannelSet::PutData ( const CVector<unsigned char>& vecbyRecBuf,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bChanOK = false; /* no free channel available */
|
/* no free channel available */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,10 +128,12 @@ bool CChannelSet::PutData ( const CVector<unsigned char>& vecbyRecBuf,
|
||||||
{
|
{
|
||||||
case PS_AUDIO_OK:
|
case PS_AUDIO_OK:
|
||||||
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_GREEN, iCurChanID );
|
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_GREEN, iCurChanID );
|
||||||
|
bChanOK = true; // in case we have an audio packet, return true
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PS_AUDIO_ERR:
|
case PS_AUDIO_ERR:
|
||||||
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_RED, iCurChanID );
|
PostWinMessage ( MS_JIT_BUF_PUT, MUL_COL_LED_RED, iCurChanID );
|
||||||
|
bChanOK = true; // in case we have an audio packet, return true
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PS_PROT_ERR:
|
case PS_PROT_ERR:
|
||||||
|
@ -142,7 +144,7 @@ bool CChannelSet::PutData ( const CVector<unsigned char>& vecbyRecBuf,
|
||||||
}
|
}
|
||||||
Mutex.unlock ();
|
Mutex.unlock ();
|
||||||
|
|
||||||
return !bChanOK; /* return 1 if error */
|
return bChanOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
|
void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
|
||||||
|
|
|
@ -124,11 +124,13 @@ void CSocket::OnDataReceived ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* server */
|
/* server */
|
||||||
// a packet was received, tell the server object to wake up if it
|
if ( pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr ) )
|
||||||
|
{
|
||||||
|
// this was an audio packet, start server
|
||||||
|
// tell the server object to wake up if it
|
||||||
// is in sleep mode (Qt will delete the event object when done)
|
// is in sleep mode (Qt will delete the event object when done)
|
||||||
QThread::postEvent ( pServer,
|
QThread::postEvent ( pServer,
|
||||||
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
|
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
|
||||||
|
}
|
||||||
pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue