|
|
|
@ -24,6 +24,7 @@ mojoRemoteClient::mojoRemoteClient( mojoKernel * ptr ):protocolParser(){ |
|
|
|
m_bRegisteredWithRemotePeer = false; |
|
|
|
m_bUseBackupServer = false; |
|
|
|
m_bActiveServer = 0; |
|
|
|
m_bCloseCommunicationReason = 0; |
|
|
|
//m_pVideoHelper = new mojoVideoTransferHelper( ARGUS_RPC_DEFAULT_MEDIA_CHUNK );
|
|
|
|
memset(&m_sINFO, 0, sizeof(ARGUS_DATA_MOJO_INFO)); |
|
|
|
m_qCMD = new RPC_CMD_QUEUE(); |
|
|
|
@ -33,25 +34,26 @@ mojoRemoteClient::~mojoRemoteClient(){ |
|
|
|
LOG("Destructor"); |
|
|
|
if( m_bRegisteredWithRemotePeer ) { |
|
|
|
LOG("Flushing"); |
|
|
|
//if( m_pVideoHelper ) delete( m_pVideoHelper );
|
|
|
|
while ( m_bRegisteredWithRemotePeer ) { |
|
|
|
m_mCurrentVTRProtector.lock(); |
|
|
|
if ( m_vVTRHelpers.size() == 0 ) break; |
|
|
|
if ( m_vVTRHelpers.size() == 0 ){ |
|
|
|
m_mCurrentVTRProtector.unlock(); |
|
|
|
break; |
|
|
|
}; |
|
|
|
m_mCurrentVTRProtector.unlock(); |
|
|
|
SLEEP( DEFAULT_THREAD_SLEEP_TIME ); |
|
|
|
}; |
|
|
|
// If disconnected but still have mem structs!
|
|
|
|
m_mCurrentVTRProtector.lock(); |
|
|
|
if ( m_vVTRHelpers.size() ) { |
|
|
|
//while ( m_vVTRHelpers.size() ) {
|
|
|
|
// mojoVideoTransferHelper *tPtr = m_qVTRHelpers.first();
|
|
|
|
// delete( tPtr );
|
|
|
|
// m_qVTRHelpers.pop();
|
|
|
|
//};
|
|
|
|
for (V_VIDEO_TRANSFER_HELPERS::iterator idx = m_vVTRHelpers.begin(); idx != m_vVTRHelpers.end(); idx++ ) delete( *idx ); |
|
|
|
m_vVTRHelpers.clear(); |
|
|
|
} else { |
|
|
|
// Still connected
|
|
|
|
// Unregister Mojo
|
|
|
|
} |
|
|
|
//Send Disconmnect
|
|
|
|
enqueueDisconnect( m_bCloseCommunicationReason ); |
|
|
|
}; |
|
|
|
m_mCurrentVTRProtector.unlock(); |
|
|
|
}; |
|
|
|
LOG("Flushing Done!"); |
|
|
|
waitThreadEnd( true ); |
|
|
|
flushTransactions(); |
|
|
|
|
|
|
|
@ -361,7 +363,14 @@ bool mojoRemoteClient::fetchNewTransaction(){ |
|
|
|
m_mCurrentCMDProtector.unlock(); |
|
|
|
return false; |
|
|
|
}; |
|
|
|
|
|
|
|
void mojoRemoteClient::enqueueDisconnect( uint8_t reason ){ |
|
|
|
static uint8_t pBuffer[400]; |
|
|
|
if( !m_bCommunicationEstablished ) return; |
|
|
|
pBuffer[ARGUS_HEADER_SIZE] = ARGUS_DATA_MSG_DISCONNECT; |
|
|
|
pBuffer[ARGUS_HEADER_SIZE+1] = reason; |
|
|
|
m_nOutbondSerial++; |
|
|
|
m_pPort->sendData( pBuffer, argus_rpc_finishupPackage( pBuffer, m_nOutbondSerial, ARGUS_HEADER_SIZE + 2 ) ); |
|
|
|
}; |
|
|
|
void mojoRemoteClient::enqueueInfoMsg(){ |
|
|
|
RPC_CMD_RECORD *tCMD = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD)); |
|
|
|
if ( tCMD ) { |
|
|
|
|