Browse Source

Fixing the Test for the only one instance of Mojo is running

pull/7/head
Evgeny Gagua 9 months ago
parent
commit
cc8d20a2ad
  1. 8
      Projects/la_serva/build
  2. 4
      Projects/la_serva/la_serva.vpj
  3. 4
      Projects/la_serva/makefile
  4. 32
      lib/App/mojo/mojoBackend.cpp
  5. 10
      lib/App/serva/servaRemoteClientHandler.cpp

8
Projects/la_serva/build

@ -4,11 +4,11 @@
#make clean -e "CFG=Debug"
#make -e "CFG=Debug" -j$(nproc)
#make clean -e "CFG=Debug86"
#make -e "CFG=Debug86" -j$(nproc)
make clean -e "CFG=Debug86"
make -e "CFG=Debug86" -j$(nproc)
make clean -e "CFG=Release86"
make -e "CFG=Release86" -j$(nproc)
#make clean -e "CFG=Release86"
#make -e "CFG=Release86" -j$(nproc)
#cd Release86
#strip ./mojo
#cd ..

4
Projects/la_serva/la_serva.vpj

@ -383,7 +383,7 @@
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec
CmdLine='g++ -c %xup -x c++ %defd -O3 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f'
CmdLine='g++ -c %xup -x c++ %defd -O0 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f'
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/>
</Target>
<Target
@ -395,7 +395,7 @@
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -O3 -w -o "%o" %objs'/>
<Exec CmdLine='g++ %xup -O0 -w -o "%o" %objs'/>
</Target>
<Target
Name="Build"

4
Projects/la_serva/makefile

@ -438,8 +438,8 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
`pkg-config --libs openssl opencv4 rdkafka++` -lliveMedia \
-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lmodbus
COMPILE=g++ -c -x c++ "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS" "-D_SERVER_APPLICATION_" "-D_OPENCV_" -O3 -w -Wpointer-arith -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O3 -w -o "$(OUTFILE)" $(ALL_OBJ)
COMPILE=g++ -c -x c++ "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS" "-D_SERVER_APPLICATION_" "-D_OPENCV_" -O0 -w -Wpointer-arith -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O0 -w -o "$(OUTFILE)" $(ALL_OBJ)
# Pattern rules
$(OUTDIR)/%.o : ../../lib/components/object/%.cpp

32
lib/App/mojo/mojoBackend.cpp

@ -174,22 +174,26 @@ int main( int argc, char *argv[] ){
| SW_INFO_DEBUG_MODE
#endif
;
//Clenup Shared Memory Zone
system( "rm -f -R /dev/shm/argus" );
//if( !isProcessUniq( argv[0] ) ){
if( fileExist( gsCFG_PID_FILE ) ){
FILE * fd = fopen( gsCFG_PID_FILE, "r" );
if ( fd ) {
char Kaka[64];
readLine( fd, Kaka, 64 );
pid_t tPID = ( pid_t ) atol( Kaka );
if ( kill( tPID, 0 ) == 0 ) {
printf("Can not Start!\nThe Process [%s] Already is Runing[PID:%lld]\n", argv[0], tPID );
return 33;
};
//if( !isProcessUniq( argv[0] ) )
if( fileExist( gsCFG_PID_FILE ) ){
FILE * fd = fopen( gsCFG_PID_FILE, "r" );
if ( fd ) {
char testString[64];
readLine( fd, testString, 64 );
pid_t tPID = ( pid_t ) atol( testString );
if ( kill( tPID, 0 ) == 0 ) {
printf("Can not Start!\nThe Process [%s] Already is Runing[PID:%lld]\n", argv[0], tPID );
fclose( fd );
return 33;
};
fclose(fd);
};
//};
};
//Clenup Shared Memory Zone
system( "rm -f -R /dev/shm/argus" );
// Reading Config
if( argc > 1 ){

10
lib/App/serva/servaRemoteClientHandler.cpp

@ -152,7 +152,7 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
strncpy( m_cRemoteIP, tM->peer, 22);
};
m_cRemoteIdentity[32] = (char)0;
#ifdef DEBUG_EXTRA
#ifdef DEBUG
char tB[128];
sprintf(tB,"Registration request from[%s][%s]", m_cRemoteIP, m_cRemoteIdentity );
LOG(tB);
@ -210,10 +210,10 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
LOG( tB );
sprintf( tB, "Camera Stream ID: %d", tINFO->CAM_STREAM_ID );
LOG( tB );
//for ( uint8_t i = 0; i < Package->m_nSize; i++ ) {
// sprintf( tB, "Data: 0x%02X", Package->m_pData[i] );
// LOG( tB );
//};
for ( uint8_t i = 0; i < Package->m_nSize; i++ ) {
sprintf( tB, "Data: 0x%02X", Package->m_pData[i] );
LOG( tB );
};
#endif
m_pDBC->updateModuleData( m_dMojoDBID, tINFO->UPPER_ID, tINFO->BOTTOM_ID, tINFO->CAM_ID, tINFO->CAM_STREAM_ID, tINFO->TLS_VERSION, tINFO->LLS_VERSION );
peer_send_reg_status( ARGUS_DATA_MSG_INFO );

Loading…
Cancel
Save