Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
fc18aaba
Commit
fc18aaba
authored
May 29, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Configuration): добавил функцию getNCReadyTimeout() для возможности
глобально менять значение по умолчанию для --sm-ready-timeout..
parent
7d711ecf
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
49 additions
and
15 deletions
+49
-15
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+2
-2
test.xml
conf/test.xml
+2
-1
IOControl.cc
extensions/IOControl/IOControl.cc
+1
-1
LProcessor.cc
extensions/LogicProcessor/LProcessor.cc
+1
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+2
-2
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+2
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+2
-2
UniExchange.cc
extensions/UniNetwork/UniExchange.cc
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+1
-1
UObject_SK.cc
extensions/lib/UObject_SK.cc
+2
-2
Configuration.h
include/Configuration.h
+2
-0
Configuration.cc
src/Various/Configuration.cc
+19
-0
test_conftest.cc
tests/test_conftest.cc
+9
-0
tests_with_conf.xml
tests/tests_with_conf.xml
+3
-0
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
fc18aaba
...
@@ -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
<
0 )
else if( sm_tout
<
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
<
0 )
else if( sm_tout
<
0 )
smReadyTimeout = UniSetTimer::WaitUpTime;
smReadyTimeout = UniSetTimer::WaitUpTime;
else
else
...
...
conf/test.xml
View file @
fc18aaba
...
@@ -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"
>
...
...
extensions/IOControl/IOControl.cc
View file @
fc18aaba
...
@@ -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
...
...
extensions/LogicProcessor/LProcessor.cc
View file @
fc18aaba
...
@@ -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
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
fc18aaba
...
@@ -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
;
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
fc18aaba
...
@@ -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
;
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
fc18aaba
...
@@ -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
()
->
getArg
Int
(
"--unet-sm-ready-timeout"
,
"120000"
);
int
tout
=
uniset_conf
()
->
getArg
PInt
(
"--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
;
...
...
extensions/UniNetwork/UniExchange.cc
View file @
fc18aaba
...
@@ -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
...
...
extensions/include/UObject_SK.h
View file @
fc18aaba
...
@@ -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_
...
...
extensions/lib/UObject_SK.cc
View file @
fc18aaba
...
@@ -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
...
...
include/Configuration.h
View file @
fc18aaba
...
@@ -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) */
...
...
src/Various/Configuration.cc
View file @
fc18aaba
...
@@ -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
{
{
...
...
tests/test_conftest.cc
View file @
fc18aaba
...
@@ -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
;
...
...
tests/tests_with_conf.xml
View file @
fc18aaba
...
@@ -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=
""
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment