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
c18305c4
Commit
c18305c4
authored
Oct 03, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(unet2): Добавил возможность делать "подсети"
(т.е. объединять узлы в группы). При помощи --unet-nodes-filter-field и --unet-nodes-filter-value
parent
addaafd3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
UNetExchange.cc
extensions/UNet2/UNetExchange.cc
+10
-2
UniSetTypes.h
include/UniSetTypes.h
+7
-1
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+15
-0
No files found.
extensions/UNet2/UNetExchange.cc
View file @
c18305c4
...
...
@@ -31,6 +31,11 @@ sender(0)
s_fvalue
=
conf
->
getArgParam
(
"--unet-filter-value"
);
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): read filter-field='"
<<
s_field
<<
"' filter-value='"
<<
s_fvalue
<<
"'"
<<
endl
;
const
string
n_field
(
conf
->
getArgParam
(
"--unet-nodes-filter-field"
));
const
string
n_fvalue
(
conf
->
getArgParam
(
"--unet-nodes-filter-value"
));
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): read nodes-filter-field='"
<<
n_field
<<
"' nodes-filter-value='"
<<
n_fvalue
<<
"'"
<<
endl
;
int
recvTimeout
=
conf
->
getArgPInt
(
"--unet-recv-timeout"
,
it
.
getProp
(
"recvTimeout"
),
5000
);
int
lostTimeout
=
conf
->
getArgPInt
(
"--unet-lost-timeout"
,
it
.
getProp
(
"lostTimeout"
),
recvTimeout
);
...
...
@@ -61,8 +66,12 @@ sender(0)
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): unet_ignore.. for "
<<
n_it
.
getProp
(
"name"
)
<<
endl
;
continue
;
}
// проверяем заданы ли фильтры для подсетей
if
(
!
n_field
.
empty
()
&&
!
check_filter
(
n_it
,
n_field
,
n_fvalue
)
)
continue
;
// Если указано поле unet_ip непосредственно у узла - берём его
// Если указано поле unet_
broadcast_
ip непосредственно у узла - берём его
// если указано общий broadcast ip для всех узлов - берём его
string
h
(
""
);
if
(
!
default_ip
.
empty
()
)
...
...
@@ -93,7 +102,6 @@ sender(0)
continue
;
}
dlog
[
Debug
::
INFO
]
<<
myname
<<
"(init): add UNetReceiver for "
<<
h
<<
":"
<<
p
<<
endl
;
if
(
checkExistUNetHost
(
h
,
p
)
)
...
...
include/UniSetTypes.h
View file @
c18305c4
...
...
@@ -19,7 +19,7 @@
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \brief базовые типы
библиотеки UniSet
* \brief базовые типы
и вспомогательные функции библиотеки UniSet
*/
// --------------------------------------------------------------------------
#ifndef UniSetTypes_H_
...
...
@@ -36,6 +36,7 @@
#include "UniSetTypes_i.hh"
#include "IOController_i.hh"
#include "Mutex.h"
#include "UniXML.h"
// -----------------------------------------------------------------------------------------
/*! Задержка в миллисекундах */
inline
void
msleep
(
unsigned
int
m
)
{
usleep
(
m
*
1000
);
}
...
...
@@ -265,6 +266,11 @@ namespace UniSetTypes
// Если @node не указано, возвращается node=DefaultObjectId
std
::
list
<
ParamSInfo
>
getSInfoList
(
std
::
string
s
,
Configuration
*
conf
=
UniSetTypes
::
conf
);
bool
is_digit
(
const
std
::
string
s
);
// Проверка xml-узла на соответсвие <...f_prop="f_val">,
// если не задано f_val, то проверяется, что просто f_prop!=""
bool
check_filter
(
UniXML_iterator
&
it
,
const
std
::
string
f_prop
,
const
std
::
string
f_val
=
""
);
// -----------------------------------------------------------------------------
}
#define atoi atoi##_Do_not_use_atoi_function_directly_Use_getIntProp90,_getArgInt_or_uni_atoi
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
c18305c4
...
...
@@ -336,3 +336,18 @@ using namespace UniSetTypes;
<<
" sensibility="
<<
c
.
sensibility
;
}
// ------------------------------------------------------------------------------------------
bool
UniSetTypes
::
check_filter
(
UniXML_iterator
&
it
,
const
std
::
string
f_prop
,
const
std
::
string
f_val
)
{
if
(
f_prop
.
empty
()
)
return
true
;
// просто проверка на не пустой field
if
(
f_val
.
empty
()
&&
it
.
getProp
(
f_prop
).
empty
()
)
return
false
;
// просто проверка что field = value
if
(
!
f_val
.
empty
()
&&
it
.
getProp
(
f_prop
)
!=
f_val
)
return
false
;
return
true
;
}
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