Commit fc18aaba authored by Pavel Vainerman's avatar Pavel Vainerman

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

глобально менять значение по умолчанию для --sm-ready-timeout..
parent 7d711ecf
......@@ -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>");
if( sm_tout == 0 )
smReadyTimeout = 120000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......@@ -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>");
if( sm_tout == 0 )
smReadyTimeout = 120000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout &lt; 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......
......@@ -171,7 +171,8 @@
<UDPExchange name="UDPExchange"/>
<UDPExchange2 name="UDPExchange2"/>
<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"/>
<RRDServer1 name="RRDServer1">
<rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0">
......
......@@ -242,7 +242,7 @@ namespace uniset
int sm_tout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", it.getProp("ready_timeout"));
if( sm_tout == 0 )
smReadyTimeout = 120000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......
......@@ -33,7 +33,7 @@ LProcessor::LProcessor( const std::string& name ):
int tout = conf->getArgInt("--sm-ready-timeout", "120000");
if( tout == 0 )
smReadyTimeout = 120000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......
......@@ -302,8 +302,8 @@ namespace uniset
void MBExchange::waitSMReady()
{
// waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
timeout_t ready_timeout = 120000;
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "");
timeout_t ready_timeout = uniset_conf()->getNCReadyTimeout();
if( tout > 0 )
ready_timeout = tout;
......
......@@ -528,8 +528,8 @@ namespace uniset
void MBSlave::waitSMReady()
{
// waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
timeout_t ready_timeout = 120000;
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "");
timeout_t ready_timeout = uniset_conf()->getNCReadyTimeout();
if( tout > 0 )
ready_timeout = tout;
......
......@@ -475,9 +475,9 @@ void UNetExchange::startReceivers()
void UNetExchange::waitSMReady()
{
// 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 )
ready_timeout = tout;
......
......@@ -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"));
if( sm_tout == 0 )
smReadyTimeout = 60000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......
......@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2017-05-03+03:00
// generate timestamp: 2017-05-29+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2017-05-03+03:00
// generate timestamp: 2017-05-29+03:00
// -----------------------------------------------------------------------------
#include <memory>
#include <iomanip>
......@@ -184,7 +184,7 @@ end_private(false)
int sm_tout = conf->getArgInt("--" + argprefix + "sm-ready-timeout","");
if( sm_tout == 0 )
smReadyTimeout = 60000;
smReadyTimeout = conf->getNCReadyTimeout();
else if( sm_tout < 0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
else
......
......@@ -123,6 +123,7 @@ namespace uniset
std::string getImagesDir() const noexcept;
timeout_t getHeartBeatTime() const noexcept;
timeout_t getNCReadyTimeout() const noexcept;
// dirs
const std::string getConfDir() const noexcept;
......@@ -233,6 +234,7 @@ namespace uniset
bool transientIOR = { false };
timeout_t heartbeat_msec = { 3000 };
timeout_t ncreadytimeout_msec = { 180000 };
};
/*! Глобальный указатель на конфигурацию (singleton) */
......
......@@ -673,6 +673,20 @@ namespace uniset
if( heartbeat_msec <= 0 )
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 )
......@@ -1251,6 +1265,11 @@ namespace uniset
{
return heartbeat_msec;
}
timeout_t Configuration::getNCReadyTimeout() const noexcept
{
return ncreadytimeout_msec;
}
// -------------------------------------------------------------------------
const string Configuration::getConfDir() const noexcept
{
......
......@@ -72,6 +72,15 @@ TEST_CASE( "Configuration", "[Configuration]" )
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" )
{
int t_argc = 0;
......
......@@ -21,6 +21,9 @@
<!-- Debug, logs -->
<UniSetDebug name="unideb" levels="crit,warn" file=""/>
<HeartBeatTime msec="2000"/>
<NCReadyTimeout msec="60000"/>
<!-- Если не указано, то считается текущий каталог -->
<ConfDir 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