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
365e4539
Commit
365e4539
authored
Sep 26, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ConsumerMaxAttempts property got IONotifyController
parent
2bb127f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
13 deletions
+29
-13
libuniset.spec
conf/libuniset.spec
+4
-1
IONotifyController.h
include/IONotifyController.h
+5
-2
IONotifyController.cc
src/Processes/IONotifyController.cc
+20
-10
No files found.
conf/libuniset.spec
View file @
365e4539
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter1
1
Release: eter1
2
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -178,6 +178,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Sep 25 2009 Pavel Vainerman <pv@altlinux.ru> 0.97-eter11
- return old mutex
* Wed Sep 23 2009 Pavel Vainerman <pv@altlinux.ru> 0.97-eter10
- new build
...
...
include/IONotifyController.h
View file @
365e4539
...
...
@@ -82,11 +82,12 @@ class IONotifyController:
public
UniSetTypes
::
ConsumerInfo
{
ConsumerInfoExt
(
const
UniSetTypes
::
ConsumerInfo
&
ci
,
UniSetObject_i_ptr
ref
=
0
)
:
UniSetObject_i_ptr
ref
=
0
,
int
maxAttemtps
=
10
)
:
UniSetTypes
::
ConsumerInfo
(
ci
),
ref
(
ref
){}
ref
(
ref
)
,
attempt
(
maxAttemtps
)
{}
UniSetObject_i_var
ref
;
int
attempt
;
};
typedef
std
::
list
<
ConsumerInfoExt
>
ConsumerList
;
...
...
@@ -250,6 +251,8 @@ class IONotifyController:
UniSetTypes
::
uniset_mutex
askAOMutex
;
/*! c */
UniSetTypes
::
uniset_mutex
askDOMutex
;
int
maxAttemtps
;
/*! timeout for consumer */
};
#endif
src/Processes/IONotifyController.cc
View file @
365e4539
...
...
@@ -44,16 +44,19 @@ IONotifyController::IONotifyController():
restorer
(
NULL
),
askDMutex
(
"askDMutex"
),
askAMutex
(
"askAMutex"
),
trshMutex
(
"trshMutex"
)
trshMutex
(
"trshMutex"
),
maxAttemtps
(
conf
->
getPIntField
(
"ConsumerMaxAttempts"
,
5
))
{
}
IONotifyController
::
IONotifyController
(
const
string
name
,
const
string
section
,
NCRestorer
*
d
)
:
IONotifyController
::
IONotifyController
(
const
string
name
,
const
string
section
,
NCRestorer
*
d
)
:
IOController
(
name
,
section
),
restorer
(
d
),
askDMutex
(
name
+
"askDMutex"
),
askAMutex
(
name
+
"askAMutex"
),
trshMutex
(
name
+
"trshMutex"
)
trshMutex
(
name
+
"trshMutex"
),
maxAttemtps
(
conf
->
getPIntField
(
"ConsumerMaxAttempts"
,
5
))
{
//
addAFilter
(
sigc
::
mem_fun
(
this
,
&
IONotifyController
::
myAFilter
)
);
...
...
@@ -66,7 +69,8 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ):
restorer
(
d
),
askDMutex
(
string
(
conf
->
oind
->
getMapName
(
id
))
+
"_askDMutex"
),
askAMutex
(
string
(
conf
->
oind
->
getMapName
(
id
))
+
"_askAMutex"
),
trshMutex
(
string
(
conf
->
oind
->
getMapName
(
id
))
+
"_trshMutex"
)
trshMutex
(
string
(
conf
->
oind
->
getMapName
(
id
))
+
"_trshMutex"
),
maxAttemtps
(
conf
->
getPIntField
(
"ConsumerMaxAttempts"
,
5
))
{
//
addAFilter
(
sigc
::
mem_fun
(
this
,
&
IONotifyController
::
myAFilter
)
);
...
...
@@ -74,7 +78,6 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ):
setDependsSlot
(
sigc
::
mem_fun
(
this
,
&
IONotifyController
::
onChangeUndefined
)
);
}
IONotifyController
::~
IONotifyController
()
{
}
...
...
@@ -112,7 +115,7 @@ bool IONotifyController::addConsumer(ConsumerList& lst, const ConsumerInfo& ci )
return
false
;
}
ConsumerInfoExt
cinf
(
ci
);
ConsumerInfoExt
cinf
(
ci
,
0
,
maxAttemtps
);
//
try
{
...
...
@@ -567,7 +570,7 @@ void IONotifyController::localSaveValue( IOController::AIOStateList::iterator& l
AskMap
::
iterator
it
=
askAIOList
.
find
(
key
(
si
.
id
,
si
.
node
)
);
if
(
it
!=
askAIOList
.
end
()
)
{
// lock
uniset_mutex_lock
lock
(
askAMutex
,
1000
);
uniset_mutex_lock
lock
(
askAMutex
,
1000
);
send
(
it
->
second
,
sm
);
}
...
...
@@ -599,9 +602,10 @@ void IONotifyController::send(ConsumerList& lst, UniSetTypes::SensorMessage& sm)
li
->
ref
=
UniSetObject_i
::
_narrow
(
op
);
}
sm
.
consumer
=
li
->
id
;
sm
.
consumer
=
li
->
id
;
li
->
ref
->
push
(
sm
.
transport_msg
()
);
break
;
li
->
attempt
=
maxAttemtps
;
// reinit attempts
break
;
}
catch
(
Exception
&
ex
)
{
...
...
@@ -619,8 +623,14 @@ void IONotifyController::send(ConsumerList& lst, UniSetTypes::SensorMessage& sm)
unideb
[
Debug
::
CRIT
]
<<
myname
<<
"(IONotifyController::send): "
<<
conf
->
oind
->
getNameById
(
li
->
id
,
li
->
node
)
<<
" !!(...)"
<<
endl
;
}
}
if
(
maxAttemtps
>
0
&&
(
--
li
->
attempt
<=
0
)
)
{
li
=
lst
.
erase
(
li
);
break
;
}
li
->
ref
=
UniSetObject_i
::
_nil
();
}
}
...
...
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