Commit fc18aaba authored by Pavel Vainerman's avatar Pavel Vainerman

(Configuration): добавил функцию getNCReadyTimeout() для возможности

глобально менять значение по умолчанию для --sm-ready-timeout..
parent 7d711ecf
...@@ -1258,7 +1258,7 @@ end_private(false) ...@@ -1258,7 +1258,7 @@ end_private(false)
int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>"); int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 120000; smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout &lt; 0 ) else if( sm_tout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
...@@ -1734,7 +1734,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000)) ...@@ -1734,7 +1734,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>"); int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","<xsl:call-template name="settings"><xsl:with-param name="varname" select="'smReadyTimeout'"/></xsl:call-template>");
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 120000; smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout &lt; 0 ) else if( sm_tout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -171,7 +171,8 @@ ...@@ -171,7 +171,8 @@
<UDPExchange name="UDPExchange"/> <UDPExchange name="UDPExchange"/>
<UDPExchange2 name="UDPExchange2"/> <UDPExchange2 name="UDPExchange2"/>
<UNetExchange name="UNetExchange"/> <UNetExchange name="UNetExchange"/>
<HeartBeatTime time_msec="5000"/> <HeartBeatTime msec="5000"/>
<NCReadyTimeout msec="120000"/>
<TestGen input1_s="Input1_S" input2_s="DumpSensor1_S" name="TestGen" output1_c="DO_C" output2_c="DO1_C"/> <TestGen input1_s="Input1_S" input2_s="DumpSensor1_S" name="TestGen" output1_c="DO_C" output2_c="DO1_C"/>
<RRDServer1 name="RRDServer1"> <RRDServer1 name="RRDServer1">
<rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0"> <rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0">
......
...@@ -242,7 +242,7 @@ namespace uniset ...@@ -242,7 +242,7 @@ namespace uniset
int sm_tout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", it.getProp("ready_timeout")); int sm_tout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", it.getProp("ready_timeout"));
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 120000; smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 ) else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -33,7 +33,7 @@ LProcessor::LProcessor( const std::string& name ): ...@@ -33,7 +33,7 @@ LProcessor::LProcessor( const std::string& name ):
int tout = conf->getArgInt("--sm-ready-timeout", "120000"); int tout = conf->getArgInt("--sm-ready-timeout", "120000");
if( tout == 0 ) if( tout == 0 )
smReadyTimeout = 120000; smReadyTimeout = conf->getNCReadyTimeout();
else if( tout < 0 ) else if( tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -302,8 +302,8 @@ namespace uniset ...@@ -302,8 +302,8 @@ namespace uniset
void MBExchange::waitSMReady() void MBExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "");
timeout_t ready_timeout = 120000; timeout_t ready_timeout = uniset_conf()->getNCReadyTimeout();
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
......
...@@ -528,8 +528,8 @@ namespace uniset ...@@ -528,8 +528,8 @@ namespace uniset
void MBSlave::waitSMReady() void MBSlave::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "");
timeout_t ready_timeout = 120000; timeout_t ready_timeout = uniset_conf()->getNCReadyTimeout();
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
......
...@@ -475,9 +475,9 @@ void UNetExchange::startReceivers() ...@@ -475,9 +475,9 @@ void UNetExchange::startReceivers()
void UNetExchange::waitSMReady() void UNetExchange::waitSMReady()
{ {
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--unet-sm-ready-timeout", "120000"); int tout = uniset_conf()->getArgPInt("--unet-sm-ready-timeout", "",uniset_conf()->getNCReadyTimeout());
timeout_t ready_timeout = 120000; timeout_t ready_timeout = uniset_conf()->getNCReadyTimeout();
if( tout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
......
...@@ -76,7 +76,7 @@ UniExchange::UniExchange(uniset::ObjectId id, uniset::ObjectId shmID, ...@@ -76,7 +76,7 @@ UniExchange::UniExchange(uniset::ObjectId id, uniset::ObjectId shmID,
int sm_tout = conf->getArgInt("--io-sm-ready-timeout", it.getProp("ready_timeout")); int sm_tout = conf->getArgInt("--io-sm-ready-timeout", it.getProp("ready_timeout"));
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 60000; smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 ) else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2017-05-03+03:00 // generate timestamp: 2017-05-29+03:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef UObject_SK_H_ #ifndef UObject_SK_H_
#define UObject_SK_H_ #define UObject_SK_H_
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2017-05-03+03:00 // generate timestamp: 2017-05-29+03:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include <memory> #include <memory>
#include <iomanip> #include <iomanip>
...@@ -184,7 +184,7 @@ end_private(false) ...@@ -184,7 +184,7 @@ end_private(false)
int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout",""); int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","");
if( sm_tout == 0 ) if( sm_tout == 0 )
smReadyTimeout = 60000; smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 ) else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime; smReadyTimeout = UniSetTimer::WaitUpTime;
else else
......
...@@ -123,6 +123,7 @@ namespace uniset ...@@ -123,6 +123,7 @@ namespace uniset
std::string getImagesDir() const noexcept; std::string getImagesDir() const noexcept;
timeout_t getHeartBeatTime() const noexcept; timeout_t getHeartBeatTime() const noexcept;
timeout_t getNCReadyTimeout() const noexcept;
// dirs // dirs
const std::string getConfDir() const noexcept; const std::string getConfDir() const noexcept;
...@@ -233,6 +234,7 @@ namespace uniset ...@@ -233,6 +234,7 @@ namespace uniset
bool transientIOR = { false }; bool transientIOR = { false };
timeout_t heartbeat_msec = { 3000 }; timeout_t heartbeat_msec = { 3000 };
timeout_t ncreadytimeout_msec = { 180000 };
}; };
/*! Глобальный указатель на конфигурацию (singleton) */ /*! Глобальный указатель на конфигурацию (singleton) */
......
...@@ -673,6 +673,20 @@ namespace uniset ...@@ -673,6 +673,20 @@ namespace uniset
if( heartbeat_msec <= 0 ) if( heartbeat_msec <= 0 )
heartbeat_msec = 3000; heartbeat_msec = 3000;
} }
// NC ready timeout init...
cnode = getNode("NCReadyTimeout");
if( cnode )
{
UniXML::iterator hit(cnode);
ncreadytimeout_msec = hit.getIntProp("msec");
if( ncreadytimeout_msec < 0 )
ncreadytimeout_msec = UniSetTimer::WaitUpTime;
else if( ncreadytimeout_msec == 0 )
ncreadytimeout_msec = 180000;
}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void Configuration::setLocalNode( const string& nodename ) void Configuration::setLocalNode( const string& nodename )
...@@ -1251,6 +1265,11 @@ namespace uniset ...@@ -1251,6 +1265,11 @@ namespace uniset
{ {
return heartbeat_msec; return heartbeat_msec;
} }
timeout_t Configuration::getNCReadyTimeout() const noexcept
{
return ncreadytimeout_msec;
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
const string Configuration::getConfDir() const noexcept const string Configuration::getConfDir() const noexcept
{ {
......
...@@ -72,6 +72,15 @@ TEST_CASE( "Configuration", "[Configuration]" ) ...@@ -72,6 +72,15 @@ TEST_CASE( "Configuration", "[Configuration]" )
CHECK( conf->getServiceID(testService) != DefaultObjectId ); CHECK( conf->getServiceID(testService) != DefaultObjectId );
} }
SECTION( "Default parameters" )
{
REQUIRE( conf->getNCReadyTimeout() == 60000 );
REQUIRE( conf->getHeartBeatTime() == 2000 );
REQUIRE( conf->getCountOfNet() == 1 );
REQUIRE( conf->getRepeatCount() == 3 );
REQUIRE( conf->getRepeatTimeout() == 50 );
}
SECTION( "Empty Constructor" ) SECTION( "Empty Constructor" )
{ {
int t_argc = 0; int t_argc = 0;
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
<!-- Debug, logs --> <!-- Debug, logs -->
<UniSetDebug name="unideb" levels="crit,warn" file=""/> <UniSetDebug name="unideb" levels="crit,warn" file=""/>
<HeartBeatTime msec="2000"/>
<NCReadyTimeout msec="60000"/>
<!-- Если не указано, то считается текущий каталог --> <!-- Если не указано, то считается текущий каталог -->
<ConfDir name=""/> <ConfDir name=""/>
<DataDir name=""/> <DataDir name=""/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment