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
254e0852
Commit
254e0852
authored
Feb 27, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UNet): подправил тесты, исправил ошибку инициализации
parent
1bf3a239
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
15 deletions
+17
-15
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+2
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+4
-6
UNetSender.h
extensions/UNetUDP/UNetSender.h
+1
-1
test_unetudp.cc
extensions/UNetUDP/tests/test_unetudp.cc
+7
-6
tests_with_sm.sh
extensions/UNetUDP/tests/tests_with_sm.sh
+1
-0
unet-udp-tester.cc
extensions/UNetUDP/unet-udp-tester.cc
+2
-1
No files found.
extensions/UNetUDP/UNetReceiver.cc
View file @
254e0852
...
...
@@ -38,10 +38,11 @@ bool UNetReceiver::PacketCompare::operator()(const UniSetUDP::UDPMessage& lhs,
}
*/
// ------------------------------------------------------------------------------------------
UNetReceiver
::
UNetReceiver
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
)
:
UNetReceiver
::
UNetReceiver
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
_
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
)
:
shm
(
smi
),
recvpause
(
10
),
updatepause
(
100
),
port
(
_port
),
recvTimeout
(
5000
),
prepareTime
(
2000
),
lostTimeout
(
200
),
/* 2*updatepause */
...
...
extensions/UNetUDP/UNetSender.cc
View file @
254e0852
...
...
@@ -25,14 +25,15 @@ using namespace std;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
UNetSender
::
UNetSender
(
const
std
::
string
&
s_host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
UNetSender
::
UNetSender
(
const
std
::
string
&
_host
,
const
ost
::
tpport_t
_
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
,
const
std
::
string
&
s_f
,
const
std
::
string
&
s_val
,
const
std
::
string
&
s_prefix
,
size_t
maxDCount
,
size_t
maxACount
)
:
s_field
(
s_f
),
s_fvalue
(
s_val
),
prefix
(
s_prefix
),
shm
(
smi
),
s_host
(
s_host
),
port
(
_port
),
s_host
(
_host
),
sendpause
(
150
),
packsendpause
(
5
),
activated
(
false
),
...
...
@@ -56,9 +57,6 @@ UNetSender::UNetSender(const std::string& s_host, const ost::tpport_t port, cons
auto
conf
=
uniset_conf
();
conf
->
initLogStream
(
unetlog
,
myname
);
// определяем фильтр
// s_field = conf->getArgParam("--udp-filter-field");
// s_fvalue = conf->getArgParam("--udp-filter-value");
unetinfo
<<
myname
<<
"(init): read filter-field='"
<<
s_field
<<
"' filter-value='"
<<
s_fvalue
<<
"'"
<<
endl
;
...
...
@@ -280,7 +278,7 @@ void UNetSender::send()
// -----------------------------------------------------------------------------
// #define UNETUDP_DISABLE_OPTIMIZATION_N1
void
UNetSender
::
real_send
(
UniSetUDP
::
UDPMessage
&
mypack
)
void
UNetSender
::
real_send
(
UniSetUDP
::
UDPMessage
&
mypack
)
{
UniSetTypes
::
uniset_rwmutex_rlock
l
(
pack_mutex
);
#ifdef UNETUDP_DISABLE_OPTIMIZATION_N1
...
...
extensions/UNetUDP/UNetSender.h
View file @
254e0852
...
...
@@ -171,7 +171,7 @@ class UNetSender
private
:
UNetSender
();
std
::
shared_ptr
<
ost
::
UDPBroadcast
>
udp
;
std
::
shared_ptr
<
ost
::
UDPBroadcast
>
udp
=
{
nullptr
}
;
ost
::
IPV4Address
addr
;
ost
::
tpport_t
port
=
{
0
};
std
::
string
s_host
=
{
""
};
...
...
extensions/UNetUDP/tests/test_unetudp.cc
View file @
254e0852
#include <catch.hpp>
// -----------------------------------------------------------------------------
#include <memory>
#include <cc++/socket.h>
#include "UniSetTypes.h"
#include "UInterface.h"
...
...
@@ -15,10 +16,10 @@ using namespace UniSetTypes;
// -----------------------------------------------------------------------------
static
int
port
=
3000
;
static
ost
::
IPV4Host
host
(
"127.255.255.255"
);
static
UInterface
*
ui
=
nullptr
;
static
shared_ptr
<
UInterface
>
ui
=
nullptr
;
static
ObjectId
aid
=
2
;
static
ost
::
UDPDuplex
*
udp_r
=
nullptr
;
static
ost
::
UDPBroadcast
*
udp_s
=
nullptr
;
static
std
::
shared_ptr
<
UDPReceiveU
>
udp_r
=
nullptr
;
static
shared_ptr
<
ost
::
UDPBroadcast
>
udp_s
=
nullptr
;
static
int
s_port
=
3003
;
// Node2
static
int
s_nodeID
=
3003
;
static
int
s_procID
=
123
;
...
...
@@ -36,7 +37,7 @@ void InitTest()
if
(
ui
==
nullptr
)
{
ui
=
new
UInterface
();
ui
=
make_shared
<
UInterface
>
();
// UI понадобиться для проверки записанных в SM значений.
CHECK
(
ui
->
getObjectIndex
()
!=
nullptr
);
CHECK
(
ui
->
getConf
()
==
conf
);
...
...
@@ -44,10 +45,10 @@ void InitTest()
}
if
(
udp_r
==
nullptr
)
udp_r
=
new
ost
::
UDPDuplex
(
host
,
port
);
udp_r
=
make_shared
<
UDPReceiveU
>
(
host
,
port
);
if
(
udp_s
==
nullptr
)
udp_s
=
new
ost
::
UDPBroadcast
(
host
,
s_port
);
udp_s
=
make_shared
<
ost
::
UDPBroadcast
>
(
host
,
s_port
);
}
// -----------------------------------------------------------------------------
// pnum - минималный номер ожидаемого пакета ( 0 - любой пришедщий )
...
...
extensions/UNetUDP/tests/tests_with_sm.sh
View file @
254e0852
...
...
@@ -11,3 +11,4 @@ cd -
./uniset2-start.sh
-f
./tests-with-sm
$*
--
--confile
unetudp-test-configure.xml
--e-startup-pause
10
\
--unet-name
UNetExchange
--unet-filter-field
unet
--unet-filter-value
1
--unet-maxdifferense
5
\
--unet-recv-timeout
1000
--unet-sendpause
500
#--unet-log-add-levels any
extensions/UNetUDP/unet-udp-tester.cc
View file @
254e0852
...
...
@@ -8,6 +8,7 @@
#include <cc++/socket.h>
#include "UDPPacket.h"
#include "PassiveTimer.h"
#include "UDPCore.h"
// --------------------------------------------------------------------------
static
struct
option
longopts
[]
=
{
...
...
@@ -201,7 +202,7 @@ int main(int argc, char* argv[])
{
case
cmdReceive
:
{
ost
::
UDPDuplex
udp
(
host
,
port
);
UDPReceiveU
udp
(
host
,
port
);
// char buf[UniSetUDP::MaxDataLen];
UniSetUDP
::
UDPMessage
pack
;
...
...
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