Browse Source

SRB ping-pong

AGP
Evgeny Gagua 1 year ago
parent
commit
86bcee9cdb
  1. 2
      Projects/la_serva/build
  2. 2
      lib/App/serva/servaRemoteClientHandler.cpp
  3. 10
      lib/App/serva/servaSessionManager.cpp
  4. 4
      lib/data/net/netClientHandler.cpp
  5. 8
      lib/data/net/netServer.cpp
  6. 26
      lib/data/transport/transportSocket.cpp

2
Projects/la_serva/build

@ -4,7 +4,7 @@
#make clean -e "CFG=Debug"
#make -e "CFG=Debug" -j$(nproc)
#make clean -e "CFG=Debug86"
make clean -e "CFG=Debug86"
make -e "CFG=Debug86" -j$(nproc)
#make clean -e "CFG=Release86"

2
lib/App/serva/servaRemoteClientHandler.cpp

@ -298,7 +298,7 @@ void servaRPCHadnler::m_fThreadProc( void ){
};
SLEEP(DEFAULT_THREAD_SLEEP_TIME);
};
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Connector Thread Ended!");
#endif
};

10
lib/App/serva/servaSessionManager.cpp

@ -243,7 +243,7 @@ bool servaSessionManager::addVideo( DBC_RPC_MEDIA_INFO_EX *ptr ){//uint32_t modu
// At Time of Video Addition the Session May be expired already!!
// No neet to Validate session!
bool bExpiredSession = false;
SESSION_DATA *sp = validateSession( ptr->session_id );
if ( sp == NULL ) {
sp = reopenSession( ptr->session_id );
@ -251,6 +251,7 @@ bool servaSessionManager::addVideo( DBC_RPC_MEDIA_INFO_EX *ptr ){//uint32_t modu
LOG_ERROR( "Session Data ptr is null!");
return false;
};
bExpiredSession = true;
};
if ( sp->m_pDataReport ) {
char tName[MAX_PATH];
@ -258,7 +259,7 @@ bool servaSessionManager::addVideo( DBC_RPC_MEDIA_INFO_EX *ptr ){//uint32_t modu
chown( tName, getUserUid(web_access_user), getUserGid(web_access_group) );
chmod( tName, DB_FILE_MODE );
updateSessionStat( ptr->session_id, false );
char tQBuf[1024];
char tQBuf[CTEXT];
sprintf( tQBuf, "INSERT INTO `videos`(`session_id`,`module_id`,`uuid`,`ts`,`ts_ms`,`ext`,`fps`) VALUES(%" PRIu64 ", %d,'%s',%d,%d,'%s',%d)",
ptr->session_id,
ptr->module_id,
@ -272,7 +273,10 @@ bool servaSessionManager::addVideo( DBC_RPC_MEDIA_INFO_EX *ptr ){//uint32_t modu
LOG( tQBuf );
#endif
bool rv = sp->m_pDataReport->SilentQuery( tQBuf );
if (sp->skeep_validation ) dropSession( ptr->session_id );
if( bExpiredSession ){
delete( sp->m_pDataReport );
free( sp );
};
return rv;
} else {
LOG_ERROR( "Report DB is closed!");

4
lib/data/net/netClientHandler.cpp

@ -25,7 +25,7 @@ networkClientHandler::networkClientHandler( int SocketFD, networkServiceEngine *
};
networkClientHandler::~networkClientHandler(){
# ifdef DEBUG
# ifdef DEBUG_EXTRA
LOG("Destructor Start");
# endif
m_pEngine = NULL;
@ -40,7 +40,7 @@ networkClientHandler::~networkClientHandler(){
# endif
};
*/
# ifdef DEBUG
# ifdef DEBUG_EXTRA
LOG("Destructor Finished");
# endif
};

8
lib/data/net/netServer.cpp

@ -386,16 +386,16 @@ void networkServer::m_fThreadProc( void ){
//LRF_ClientHandler *tClient = (LRF_ClientHandler *)(*index);
if( (*index)->getStatus() == false ){
// Remove Client Handler
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Remove Client");
#endif
if( m_pKernelEngine ){
if ( m_pKernelEngine->detachClient( (*index) ) ){
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Client Stoped");
#endif
m_vHandlersPool.erase( index );
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Remove Client Done");
#endif
} else LOG_ERROR("Client detach from Kernel Failure!");
@ -447,12 +447,12 @@ void networkServer::m_fThreadProc( void ){
flags |= O_NONBLOCK | O_NDELAY;
//RetCode = ioctl( MainSocket, FIONBIO, (char *) &dontblock );
RetCode = fcntl( ClientSocket, F_SETFL, flags );
#ifdef DEBUG_EXTRA
if ( RetCode == 0 ){
LOG( "Set N-Blocking Mode of Client Socket" );
} else {
LOG( "Can't set N-Blocking Mode of Client Socket" );
};
#ifdef DEBUG
LOG( "Client Connection Accepted" );
#endif
if( m_pKernelEngine ) {

26
lib/data/transport/transportSocket.cpp

@ -38,12 +38,12 @@ transportSocket::transportSocket() : basicTransport(), basicDualThread(){
// Destructor implementation
transportSocket::~transportSocket(){
# ifdef DEBUG
# ifdef DEBUG_EXTRA
LOG("Destructor begin!");
# endif
m_mBufferProtectorMutex.unlock();
_close();
# ifdef DEBUG
# ifdef DEBUG_EXTRA
LOG("Destructor end!");
# endif
};
@ -57,23 +57,23 @@ bool transportSocket::create( void ){
bool transportSocket::_close( void ){
setConnectionStatus( CS_DISCONNECTED );
LOG("Sending Close Req!");
//LOG("Sending Close Req!");
if( m_iControlPipeFD[0] > -1 ){
LOG("Sending Close Req[1]!");
//LOG("Sending Close Req[1]!");
write( m_iControlPipeFD[0], "E", 1 );
};
if( m_iControlPipeFD[1] > -1 ){
LOG("Sending Close Req[2]!");
//LOG("Sending Close Req[2]!");
write( m_iControlPipeFD[1], "E", 1 );
};
if( m_bInitComplete ) m_bInitComplete = !uninit();
LOG("Closeing FIDs!");
//LOG("Closeing FIDs!");
if ( m_iControlPipeFD[0] > -1 ){
LOG("Closeing FIDs[1]!");
//LOG("Closeing FIDs[1]!");
close( m_iControlPipeFD[0] );
};
if ( m_iControlPipeFD[1] > -1 ){
LOG("Closeing FIDs[2]!");
//LOG("Closeing FIDs[2]!");
close( m_iControlPipeFD[1] );
};
return true;
@ -132,14 +132,14 @@ void transportSocket::m_fThreadAProc(void){
if ( buffer == 'E' ) {
//m_bThreadBStatus = TH_ENDED;
m_bThreadAStatus = TH_ENDED;
LOG("Requesting Destruction of Transport[s]!");
//LOG("Requesting Destruction of Transport[s]!");
};
};
};
};
};
};
LOG("Sender Thread End!");
//LOG("Sender Thread End!");
};
void transportSocket::m_fThreadBProc(void){
@ -177,8 +177,10 @@ void transportSocket::m_fThreadBProc(void){
setConnectionStatus(CS_DISCONNECTED);
m_nInputBufferSize = 0;
m_bThreadBStatus = TH_ENDED;
//m_bThreadAStatus = TH_ENDED;
//m_bThreadAStatus = TH_ENDED;
#ifdef DEBUG_EXTRA
LOG_ERROR("Connection Droped on Reception Data");
#endif
} else if( m_nInputBufferSize > 0 ){
do{
m_mQueueProtectorMutex.lock();
@ -203,7 +205,9 @@ void transportSocket::m_fThreadBProc(void){
};
};
};
#ifdef DEBUG_EXTRA
LOG("Recipient Thread End!");
#endif
};
bool transportSocket::sendData(unsigned char *Data, int DataSize){

Loading…
Cancel
Save