This commit is contained in:
Volker Fischer 2006-03-06 19:18:25 +00:00
parent 576b87b49e
commit 29457cba80

View file

@ -86,10 +86,6 @@ void CProtocol::EnqueueMessage ( CVector<uint8_t>& vecMessage,
const int iCnt, const int iCnt,
const int iID ) const int iID )
{ {
qDebug("EnqueueMessage start");
// check if list is empty so that we have to initiate a send process // check if list is empty so that we have to initiate a send process
const bool bListWasEmpty = SendMessQueue.empty(); const bool bListWasEmpty = SendMessQueue.empty();
@ -104,18 +100,10 @@ qDebug("EnqueueMessage start");
{ {
SendMessage(); SendMessage();
} }
qDebug("EnqueueMessage end");
} }
void CProtocol::SendMessage() void CProtocol::SendMessage()
{ {
qDebug("SendMessage start");
// we have to check that list is not empty, since in another thread the // we have to check that list is not empty, since in another thread the
// last element of the list might have been erased // last element of the list might have been erased
if ( !SendMessQueue.empty() ) if ( !SendMessQueue.empty() )
@ -134,10 +122,6 @@ qDebug("SendMessage start");
// no message to send, stop timer // no message to send, stop timer
TimerSendMess.stop(); TimerSendMess.stop();
} }
qDebug("SendMessage stop");
} }
void CProtocol::CreateAndSendAcknMess ( const int& iID, const int& iCnt ) void CProtocol::CreateAndSendAcknMess ( const int& iID, const int& iCnt )
@ -146,10 +130,6 @@ void CProtocol::CreateAndSendAcknMess ( const int& iID, const int& iCnt )
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
unsigned int iPos = 0; // init position pointer unsigned int iPos = 0; // init position pointer
qDebug("CreateAndSendAcknMess start");
// build data vector // build data vector
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iID ), 2 ); PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iID ), 2 );
@ -158,10 +138,6 @@ qDebug("CreateAndSendAcknMess start");
// immediately send acknowledge message // immediately send acknowledge message
emit MessReadyForSending ( vecAcknMessage ); emit MessReadyForSending ( vecAcknMessage );
qDebug("CreateAndSendAcknMess end");
} }
@ -171,21 +147,21 @@ qDebug("CreateAndSendAcknMess end");
*/ */
void CProtocol::DeleteSendMessQueue() void CProtocol::DeleteSendMessQueue()
{ {
// Mutex.lock(); Mutex.lock();
// { {
// delete complete "send message queue" // delete complete "send message queue"
SendMessQueue.clear(); SendMessQueue.clear();
// } }
// Mutex.unlock(); Mutex.unlock();
} }
void CProtocol::OnTimerSendMess() void CProtocol::OnTimerSendMess()
{ {
// Mutex.lock(); Mutex.lock();
// { {
SendMessage(); SendMessage();
// } }
// Mutex.unlock(); Mutex.unlock();
} }
bool CProtocol::ParseMessage ( const CVector<unsigned char>& vecbyData, bool CProtocol::ParseMessage ( const CVector<unsigned char>& vecbyData,
@ -194,15 +170,10 @@ bool CProtocol::ParseMessage ( const CVector<unsigned char>& vecbyData,
/* /*
return code: true -> ok; false -> error return code: true -> ok; false -> error
*/ */
bool bRet;
qDebug("before lock");
Mutex.lock(); Mutex.lock();
{ {
qDebug("after lock");
int iRecCounter, iRecID, iData; int iRecCounter, iRecID, iData;
unsigned int iPos; unsigned int iPos;
CVector<uint8_t> vecData; CVector<uint8_t> vecData;
@ -275,20 +246,22 @@ for ( int i = 0; i < iNumBytes; i++ ) {
iOldRecID = iRecID; iOldRecID = iRecID;
iOldRecCnt = iRecCounter; iOldRecCnt = iRecCounter;
return true; // everything was ok bRet = true; // everything was ok
} }
else else
{ {
return false; // return error code bRet = false; // return error code
} }
} }
Mutex.unlock(); Mutex.unlock();
return bRet;
} }
void CProtocol::CreateJitBufMes ( const int iJitBufSize ) void CProtocol::CreateJitBufMes ( const int iJitBufSize )
{ {
// Mutex.lock(); Mutex.lock();
// { {
CVector<uint8_t> vecNewMessage; CVector<uint8_t> vecNewMessage;
CVector<uint8_t> vecData ( 2 ); // 2 bytes of data CVector<uint8_t> vecData ( 2 ); // 2 bytes of data
unsigned int iPos = 0; // init position pointer unsigned int iPos = 0; // init position pointer
@ -307,8 +280,8 @@ void CProtocol::CreateJitBufMes ( const int iJitBufSize )
// enqueue message // enqueue message
EnqueueMessage ( vecNewMessage, iCurCounter, PROTMESSID_JITT_BUF_SIZE ); EnqueueMessage ( vecNewMessage, iCurCounter, PROTMESSID_JITT_BUF_SIZE );
// } }
// Mutex.unlock(); Mutex.unlock();
} }