Browse Source

Watchdog delete dead UX socket file on startup

AGP
Evgeny Gagua 2 years ago
parent
commit
12787aa7a1
  1. 2
      Projects/la_mojo/build
  2. 6
      Projects/watchDogDaemon/kernel.cpp
  3. 6
      Projects/watchDogDaemon/watchDogDaemon.cpp
  4. 17
      lib/App/common/kernelModuleEmbedVideo.cpp
  5. 13
      lib/App/mojo/mojoRemoteClient.cpp

2
Projects/la_mojo/build

@ -1,7 +1,7 @@
#! /bin/sh
#make clean -e "CFG=Debug"
make clean -e "CFG=Debug"
make -e "CFG=Debug" -j$(nproc)
#make clean -e "CFG=Debug86"

6
Projects/watchDogDaemon/kernel.cpp

@ -189,8 +189,12 @@ bool SP_KERNEL::create(void){
LOG_ERROR("Failed Read Config Settings!");
return false;
};
// Remove Dead Process Socket
if ( fileExist( m_pUnixSocketName ) ) {
unlink( m_pUnixSocketName );
};
m_iServerSocket = socket( AF_UNIX, SOCK_STREAM, 0 );
m_iServerSocket = socket(AF_UNIX, SOCK_STREAM, 0);
struct sockaddr_un server_addr;
server_addr.sun_family = AF_UNIX;

6
Projects/watchDogDaemon/watchDogDaemon.cpp

@ -322,7 +322,11 @@ int main (int argc, char *argv[]){
CLE = NULL;
if( m_pLog ) delete( m_pLog );
m_pLog = NULL;
system("/sbin/reboot");
if ( fileExist( "/srv/scripts/reboot.sh" ) ){
system("/srv/scripts/reboot.sh");
} else {
system("/sbin/reboot");
};
};
};
} while( m_bKernelExitCode > 0 );

17
lib/App/common/kernelModuleEmbedVideo.cpp

@ -1448,7 +1448,7 @@ bool kernelModuleEmbedVideo::dispatchEvent( EVENT_CONTAINER *Evt ){
break;
};
case EVT_CAMERA_ON_POSITION:{
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Cam On Position After Event -> Capture Picture");
#endif
DBC_SNAPSHOT_DATA *tData = (DBC_SNAPSHOT_DATA *) Evt->m_pEvtData;
@ -1457,7 +1457,7 @@ bool kernelModuleEmbedVideo::dispatchEvent( EVENT_CONTAINER *Evt ){
tData->assoc_event_ids.clear();
delete( tData );
Evt->m_pEvtData = NULL;
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Event Data Saved!");
#endif
} else LOG_ERROR("No Evt Data!");
@ -1477,8 +1477,9 @@ bool kernelModuleEmbedVideo::dispatchEvent( EVENT_CONTAINER *Evt ){
bool kernelModuleEmbedVideo::saveStreamPicture( DBC_SNAPSHOT_DATA *ptr ){
if( ptr == NULL ) return false;
if( ( m_sEmbedVideoData.output_mode & EVE_OUTPUT_PICTURES ) == EVE_OUTPUT_PICTURES ){
#ifdef DEBUG_EXTRA
LOG("Saving Picture!");
#endif
//saveStreamPicture( ptr->stream_id );
//*
@ -1501,20 +1502,20 @@ bool kernelModuleEmbedVideo::saveStreamPicture( DBC_SNAPSHOT_DATA *ptr ){
m_mPictureProtector.unlock();
LOG_ERROR("No memory to allocate!");
};
#ifdef DEBUG
#ifdef DEBUG_EXTRA
} else {
LOG("No apropriate Stream Found!");
#endif
};
};
//*/
#ifdef DEBUG
#ifdef DEBUG_EXTRA
} else {
LOG("No Pic Mode!");
#endif
}
if( ( m_sEmbedVideoData.output_mode & EVE_OUTPUT_VIDEO ) == EVE_OUTPUT_VIDEO ){
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Saving Video!");
#endif
if( ptr->assoc_event_ids.size() ){
@ -1525,13 +1526,13 @@ bool kernelModuleEmbedVideo::saveStreamPicture( DBC_SNAPSHOT_DATA *ptr ){
uint32_t cfrm;
for( DBC_INT_LIST::iterator idx = ptr->assoc_event_ids.begin(); idx < ptr->assoc_event_ids.end(); idx++ )
(*hnd).second->triggerEvent( (*idx), db_id, cfrm );
#ifdef DEBUG
#ifdef DEBUG_EXTRA
} else {
LOG("No Stream Found!");
#endif
};
m_mStreamHandlersProtector.unlock();
#ifdef DEBUG
#ifdef DEBUG_EXTRA
} else {
LOG("No Assoc EVTIDS!");
#endif

13
lib/App/mojo/mojoRemoteClient.cpp

@ -606,17 +606,17 @@ bool mojoRemoteClient::validate(){
};
bool mojoRemoteClient::addEvent( EVENT_CONTAINER *Evt ){
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Add Evt!");
#endif
if ( Evt == NULL ) return false;
RPC_CMD_RECORD *tPack = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
if ( tPack ) {
#ifdef DEBUG_EXTRA
char tB[128];
sprintf(tB, "TS: %d.%d", Evt->m_UMSTS / 1000, Evt->m_UMSTS % 1000 );
LOG( tB );
#endif
tPack->DATA = (void*) argus_rpc_convert_evt( Evt );
if ( tPack->DATA ) {
tPack->CMD = ARGUS_DATA_MSG_EVT;
@ -630,7 +630,7 @@ bool mojoRemoteClient::addEvent( EVENT_CONTAINER *Evt ){
};
bool mojoRemoteClient::addVideo( VIDEO_SEGMENT_INFO *ptr ){
#ifdef DEBUG
#ifdef DEBUG_EXTRA
LOG("Add Video!");
#endif
if ( ptr == NULL ) return false;
@ -693,10 +693,11 @@ bool mojoVideoTransferHelper::init( VIDEO_SEGMENT_INFO *ptr ){
m_sIn.FMT[5]=(char)0;
m_sIn.WIDTH = ptr->streamWidth;
m_sIn.HEIGHT = ptr->streamHeight;
#ifdef DEBUG_EXTRA
char tB[129];
sprintf( tB, "VideoInfo Init: [%dx%d]@%d TS: %d.%d", m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.DTS, m_sIn.DMS );
LOG(tB);
LOG(tB);
#endif
m_pFD = fopen( m_cCurrentFile, "r" );
if( m_bVideoOpened = m_pFD != NULL ) return true;
return false;

Loading…
Cancel
Save