do not start server when protocol message is received

This commit is contained in:
Volker Fischer 2006-03-07 21:52:21 +00:00
parent cff359cbaf
commit 5c42d81137
2 changed files with 13 additions and 9 deletions

View file

@ -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,

View file

@ -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 ) )
// is in sleep mode (Qt will delete the event object when done) {
QThread::postEvent ( pServer, // this was an audio packet, start server
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) ); // tell the server object to wake up if it
// is in sleep mode (Qt will delete the event object when done)
pChannelSet->PutData ( vecbyRecBuf, iNumBytesRead, RecHostAddr ); QThread::postEvent ( pServer,
new CLlconEvent ( MS_PACKET_RECEIVED, 0, 0 ) );
}
} }
} }