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
d201c7cf
Commit
d201c7cf
authored
May 29, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UNet): добавил функцию для возожности задать timeout на запуск eventloop.
Если не удалось, процесс вылетает (std::terminate). А также (временно) убрал нестабильный тест на проверку связи.
parent
0d35c405
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
3 deletions
+31
-3
libuniset2.spec
conf/libuniset2.spec
+3
-0
test.xml
conf/test.xml
+6
-0
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+5
-1
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+12
-1
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+2
-0
test_unetudp.cc
extensions/UNetUDP/tests/test_unetudp.cc
+2
-0
CommonEventLoop.h
include/CommonEventLoop.h
+1
-1
No files found.
conf/libuniset2.spec
View file @
d201c7cf
...
@@ -511,6 +511,9 @@ rm -f %buildroot%_libdir/*.la
...
@@ -511,6 +511,9 @@ rm -f %buildroot%_libdir/*.la
* Tue Sep 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt19.1
* Tue Sep 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt19.1
- Rebuild with poco 1.7.9
- Rebuild with poco 1.7.9
# * Mon May 29 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt21
# - (UNetExchange): add function for setup eventloop timeout
# * Sun May 28 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt20
# * Sun May 28 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt20
# - (Configuration): fixed bug in check endPoint function
# - (Configuration): fixed bug in check endPoint function
...
...
conf/test.xml
View file @
d201c7cf
...
@@ -213,6 +213,12 @@
...
@@ -213,6 +213,12 @@
<item
id=
"3001"
infserver=
"InfoServer"
ip=
"127.0.0.1"
name=
"LocalhostNode1"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2049"
/>
<item
id=
"3001"
infserver=
"InfoServer"
ip=
"127.0.0.1"
name=
"LocalhostNode1"
textname=
"Локальный узел"
unet_ignore=
"0"
unet_port=
"2049"
/>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"Node1"
textname=
"Node1"
unet_ignore=
"0"
unet_port=
"3001"
unet_respond_id=
"Input1_S"
unet_respond_invert=
"1"
/>
<item
id=
"3002"
ip=
"192.168.56.10"
name=
"Node1"
textname=
"Node1"
unet_ignore=
"0"
unet_port=
"3001"
unet_respond_id=
"Input1_S"
unet_respond_invert=
"1"
/>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"Node2"
textname=
"Node2"
unet_ignore=
"0"
unet_port=
"3002"
/>
<item
id=
"3003"
ip=
"192.168.56.11"
name=
"Node2"
textname=
"Node2"
unet_ignore=
"0"
unet_port=
"3002"
/>
<item
id=
"3004"
ip=
"192.168.56.12"
name=
"Node3"
textname=
"Node3"
/>
<item
id=
"3005"
ip=
"192.168.56.13"
name=
"Node4"
textname=
"Node4"
/>
<item
id=
"3006"
ip=
"192.168.56.14"
name=
"Node5"
textname=
"Node5"
/>
<item
id=
"3007"
ip=
"192.168.56.15"
name=
"Node6"
textname=
"Node6"
/>
<item
id=
"3008"
ip=
"192.168.56.16"
name=
"Node7"
textname=
"Node7"
/>
<item
id=
"3009"
ip=
"192.168.56.17"
name=
"Node8"
textname=
"Node8"
/>
</nodes>
</nodes>
<!-- ************************ Датчики ********************** -->
<!-- ************************ Датчики ********************** -->
<sensors
name=
"Sensors"
>
<sensors
name=
"Sensors"
>
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
d201c7cf
...
@@ -75,7 +75,8 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
...
@@ -75,7 +75,8 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
<<
"' nodes-filter-value='"
<<
n_fvalue
<<
"'"
<<
endl
;
<<
"' nodes-filter-value='"
<<
n_fvalue
<<
"'"
<<
endl
;
int
recvTimeout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-recv-timeout"
,
it
.
getProp
(
"recvTimeout"
),
5000
);
int
recvTimeout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-recv-timeout"
,
it
.
getProp
(
"recvTimeout"
),
5000
);
int
prepareTime
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-preapre-time"
,
it
.
getProp
(
"prepareTime"
),
2000
);
int
prepareTime
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-prepare-time"
,
it
.
getProp
(
"prepareTime"
),
2000
);
int
evrunTimeout
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-evrun-timeout"
,
it
.
getProp
(
"evrunTimeout"
),
15000
);
int
recvpause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-recvpause"
,
it
.
getProp
(
"recvpause"
),
10
);
int
recvpause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-recvpause"
,
it
.
getProp
(
"recvpause"
),
10
);
int
sendpause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-sendpause"
,
it
.
getProp
(
"sendpause"
),
100
);
int
sendpause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-sendpause"
,
it
.
getProp
(
"sendpause"
),
100
);
int
updatepause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-updatepause"
,
it
.
getProp
(
"updatepause"
),
100
);
int
updatepause
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-updatepause"
,
it
.
getProp
(
"updatepause"
),
100
);
...
@@ -334,6 +335,7 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
...
@@ -334,6 +335,7 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
r
->
setReceiveTimeout
(
recvTimeout
);
r
->
setReceiveTimeout
(
recvTimeout
);
r
->
setPrepareTime
(
prepareTime
);
r
->
setPrepareTime
(
prepareTime
);
r
->
setEvrunTimeout
(
evrunTimeout
);
r
->
setLostTimeout
(
lostTimeout
);
r
->
setLostTimeout
(
lostTimeout
);
r
->
setReceivePause
(
recvpause
);
r
->
setReceivePause
(
recvpause
);
r
->
setUpdatePause
(
updatepause
);
r
->
setUpdatePause
(
updatepause
);
...
@@ -362,6 +364,8 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
...
@@ -362,6 +364,8 @@ UNetExchange::UNetExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const
r2
->
setLockUpdate
(
true
);
r2
->
setLockUpdate
(
true
);
r2
->
setReceiveTimeout
(
recvTimeout
);
r2
->
setReceiveTimeout
(
recvTimeout
);
r2
->
setPrepareTime
(
prepareTime
);
r2
->
setEvrunTimeout
(
evrunTimeout
);
r2
->
setLostTimeout
(
lostTimeout
);
r2
->
setLostTimeout
(
lostTimeout
);
r2
->
setReceivePause
(
recvpause
);
r2
->
setReceivePause
(
recvpause
);
r2
->
setUpdatePause
(
updatepause
);
r2
->
setUpdatePause
(
updatepause
);
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
d201c7cf
...
@@ -139,6 +139,11 @@ void UNetReceiver::setMaxDifferens( unsigned long set ) noexcept
...
@@ -139,6 +139,11 @@ void UNetReceiver::setMaxDifferens( unsigned long set ) noexcept
maxDifferens
=
set
;
maxDifferens
=
set
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setEvrunTimeout
(
timeout_t
msec
)
noexcept
{
evrunTimeout
=
msec
;
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setRespondID
(
uniset
::
ObjectId
id
,
bool
invert
)
noexcept
void
UNetReceiver
::
setRespondID
(
uniset
::
ObjectId
id
,
bool
invert
)
noexcept
{
{
sidRespond
=
id
;
sidRespond
=
id
;
...
@@ -224,7 +229,12 @@ void UNetReceiver::start()
...
@@ -224,7 +229,12 @@ void UNetReceiver::start()
if
(
!
activated
)
if
(
!
activated
)
{
{
activated
=
true
;
activated
=
true
;
loop
.
evrun
(
this
,
true
);
if
(
!
loop
.
evrun
(
this
,
true
,
evrunTimeout
)
)
{
unetcrit
<<
myname
<<
"(start): evrun FAILED! (timeout="
<<
evrunTimeout
<<
" msec)"
<<
endl
;
std
::
terminate
();
return
;
}
if
(
upStrategy
==
useUpdateThread
&&
!
upThread
->
isRunning
()
)
if
(
upStrategy
==
useUpdateThread
&&
!
upThread
->
isRunning
()
)
upThread
->
start
();
upThread
->
start
();
...
@@ -938,6 +948,7 @@ const std::string UNetReceiver::getShortInfo() const noexcept
...
@@ -938,6 +948,7 @@ const std::string UNetReceiver::getShortInfo() const noexcept
<<
"
\t
["
<<
"
\t
["
<<
" recvTimeout="
<<
setw
(
6
)
<<
recvTimeout
<<
" recvTimeout="
<<
setw
(
6
)
<<
recvTimeout
<<
" prepareTime="
<<
setw
(
6
)
<<
prepareTime
<<
" prepareTime="
<<
setw
(
6
)
<<
prepareTime
<<
" evrunTimeout="
<<
setw
(
6
)
<<
evrunTimeout
<<
" lostTimeout="
<<
setw
(
6
)
<<
lostTimeout
<<
" lostTimeout="
<<
setw
(
6
)
<<
lostTimeout
<<
" recvpause="
<<
setw
(
6
)
<<
recvpause
<<
" recvpause="
<<
setw
(
6
)
<<
recvpause
<<
" updatepause="
<<
setw
(
6
)
<<
updatepause
<<
" updatepause="
<<
setw
(
6
)
<<
updatepause
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
d201c7cf
...
@@ -137,6 +137,7 @@ namespace uniset
...
@@ -137,6 +137,7 @@ namespace uniset
void
setPrepareTime
(
timeout_t
msec
)
noexcept
;
void
setPrepareTime
(
timeout_t
msec
)
noexcept
;
void
setCheckConnectionPause
(
timeout_t
msec
)
noexcept
;
void
setCheckConnectionPause
(
timeout_t
msec
)
noexcept
;
void
setMaxDifferens
(
unsigned
long
set
)
noexcept
;
void
setMaxDifferens
(
unsigned
long
set
)
noexcept
;
void
setEvrunTimeout
(
timeout_t
msec
)
noexcept
;
void
setRespondID
(
uniset
::
ObjectId
id
,
bool
invert
=
false
)
noexcept
;
void
setRespondID
(
uniset
::
ObjectId
id
,
bool
invert
=
false
)
noexcept
;
void
setLostPacketsID
(
uniset
::
ObjectId
id
)
noexcept
;
void
setLostPacketsID
(
uniset
::
ObjectId
id
)
noexcept
;
...
@@ -279,6 +280,7 @@ namespace uniset
...
@@ -279,6 +280,7 @@ namespace uniset
PassiveTimer
ptPrepare
;
PassiveTimer
ptPrepare
;
timeout_t
recvTimeout
=
{
5000
};
// msec
timeout_t
recvTimeout
=
{
5000
};
// msec
timeout_t
prepareTime
=
{
2000
};
timeout_t
prepareTime
=
{
2000
};
timeout_t
evrunTimeout
=
{
15000
};
timeout_t
lostTimeout
=
{
200
};
timeout_t
lostTimeout
=
{
200
};
PassiveTimer
ptLostTimeout
;
PassiveTimer
ptLostTimeout
;
size_t
lostPackets
=
{
0
};
/*!< счётчик потерянных пакетов */
size_t
lostPackets
=
{
0
};
/*!< счётчик потерянных пакетов */
...
...
extensions/UNetUDP/tests/test_unetudp.cc
View file @
d201c7cf
...
@@ -194,6 +194,7 @@ TEST_CASE("[UNetUDP]: sizeOf", "[unetudp][sizeof]")
...
@@ -194,6 +194,7 @@ TEST_CASE("[UNetUDP]: sizeOf", "[unetudp][sizeof]")
REQUIRE
(
len
==
m
.
sizeOf
()
);
REQUIRE
(
len
==
m
.
sizeOf
()
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#if 0
TEST_CASE("[UNetUDP]: respond sensor", "[unetudp]")
TEST_CASE("[UNetUDP]: respond sensor", "[unetudp]")
{
{
InitTest();
InitTest();
...
@@ -206,6 +207,7 @@ TEST_CASE("[UNetUDP]: respond sensor", "[unetudp]")
...
@@ -206,6 +207,7 @@ TEST_CASE("[UNetUDP]: respond sensor", "[unetudp]")
msleep(5000);
msleep(5000);
REQUIRE( ui->getValue(node1_not_respond_s) == 1 );
REQUIRE( ui->getValue(node1_not_respond_s) == 1 );
}
}
#endif
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
TEST_CASE
(
"[UNetUDP]: check sender"
,
"[unetudp][sender]"
)
TEST_CASE
(
"[UNetUDP]: check sender"
,
"[unetudp][sender]"
)
{
{
...
...
include/CommonEventLoop.h
View file @
d201c7cf
...
@@ -67,7 +67,7 @@ namespace uniset
...
@@ -67,7 +67,7 @@ namespace uniset
* Даже если thread = false, но wather не сможет быть "активирован" функция вернёт управление
* Даже если thread = false, но wather не сможет быть "активирован" функция вернёт управление
* с return false.
* с return false.
*/
*/
bool
evrun
(
EvWatcher
*
w
,
bool
thread
=
true
,
size_t
waitPrepareTimeout_msec
=
8
000
);
bool
evrun
(
EvWatcher
*
w
,
bool
thread
=
true
,
size_t
waitPrepareTimeout_msec
=
15
000
);
/*! \return TRUE - если это был последний EvWatcher и loop остановлен */
/*! \return TRUE - если это был последний EvWatcher и loop остановлен */
bool
evstop
(
EvWatcher
*
w
);
bool
evstop
(
EvWatcher
*
w
);
...
...
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