Browse Source

Prev. attempt to fix was changed to Delay Connection to Remode Server untill Nodes are in Pending Load State

pull/7/head
Evgeny Gagua 9 months ago
parent
commit
347a446116
  1. 1
      lib/App/common/deviceNodeFactory.h
  2. 19
      lib/App/mojo/mojoKernel.cpp

1
lib/App/common/deviceNodeFactory.h

@ -25,6 +25,7 @@ class deviceNodeFactory: public basicThread{
deviceNode * getNode( uint32_t id );
uint32_t getNodesCount( ARGUS_NODE_TYPE type );
bool loadNodes();
bool nodesAreLoaded(){ return m_vDeviceNodes.size()>0; };
bool unloadNodes( void );
bool reloadNodes( );
bool reloadNode( uint32_t NodeID );

19
lib/App/mojo/mojoKernel.cpp

@ -229,7 +229,8 @@ bool mojoKernel::create(){
m_bDebugMode = m_pDBC->getAppDebugMode();
if ( m_bDebugMode ) m_bKeepLocalReport = true; //Forced in case of debug mode
m_bWorkWithRemoteServer = m_sSiteData.use_remote_server;
/// m_bWorkWithRemoteServer = m_sSiteData.use_remote_server; ->
/// since Connection is delayed - must be not set at beginning
//Check date/Time if correct!
// Just in case that we have local reports
@ -288,8 +289,8 @@ bool mojoKernel::create(){
return false;
};
m_pNodeFactory->loadNodes();
// Must Be moved elsewhere To be connected after all Nodes are Loadded ?? at Node's Validation ??
/*
if ( m_bWorkWithRemoteServer ) {
#ifdef DEBUG
LOG("Working With Remote Server");
@ -300,7 +301,7 @@ bool mojoKernel::create(){
} else LOG_ERROR("Cannot Connect to Remote Server!");
} else m_bWorkWithRemoteServer = false;
};
*/
return init();
};
@ -540,6 +541,16 @@ void mojoKernel::m_fThreadProc( void ){
if( m_pRPC ){
m_pRPC->validate();
m_bWorkWithRemoteServer = ( m_pRPC->getConnectionStatus() == CS_CONNECTED );
} else {
//Checking if Nodes are Loadded
if( m_pNodeFactory->nodesAreLoaded() ){
#ifdef DEBUG
LOG("Initial Connect to Remote Server");
#endif
if ( m_pRPC = new mojoRemoteClient( this ) ) {
if( !( m_bWorkWithRemoteServer = m_pRPC->create() ) ) LOG_ERROR("Cannot Connect to Remote Server!");
} else m_bWorkWithRemoteServer = false;
};
};
};
DBC_PUSHED_CMD * tCMD = m_pDBC->getNodePushedCMD( m_nServerNodeID ); //Kernel

Loading…
Cancel
Save