Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
ff0b9b45
Commit
ff0b9b45
authored
Aug 07, 2013
by
Stephen Morris
Browse files
Options
Browse Files
Download
Plain Diff
[master] Merge branch 'trac3050'
parents
72bcad54
35f65cf6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
src/lib/hooks/callout_manager.cc
src/lib/hooks/callout_manager.cc
+5
-3
src/lib/hooks/tests/handles_unittest.cc
src/lib/hooks/tests/handles_unittest.cc
+18
-0
No files found.
src/lib/hooks/callout_manager.cc
View file @
ff0b9b45
...
...
@@ -113,13 +113,15 @@ CalloutManager::calloutsPresent(int hook_index) const {
void
CalloutManager
::
callCallouts
(
int
hook_index
,
CalloutHandle
&
callout_handle
)
{
// Clear the "skip" flag so we don't carry state from a previous call.
// This is done regardless of whether callouts are present to avoid passing
// any state from the previous call of callCallouts().
callout_handle
.
setSkip
(
false
);
// Only initialize and iterate if there are callouts present. This check
// also catches the case of an invalid index.
if
(
calloutsPresent
(
hook_index
))
{
// Clear the "skip" flag so we don't carry state from a previous call.
callout_handle
.
setSkip
(
false
);
// Set the current hook index. This is used should a callout wish to
// determine to what hook it is attached.
current_hook_
=
hook_index
;
...
...
src/lib/hooks/tests/handles_unittest.cc
View file @
ff0b9b45
...
...
@@ -841,6 +841,24 @@ TEST_F(HandlesTest, ReturnSkipClear) {
EXPECT_FALSE
(
callout_handle
.
getSkip
());
}
// Check that the skip flag is cleared when callouts are called - even if
// there are no callouts.
TEST_F
(
HandlesTest
,
NoCalloutsSkipTest
)
{
// Note - no callouts are registered on any hook.
CalloutHandle
callout_handle
(
getCalloutManager
());
// Clear the skip flag and call a hook with no callouts.
callout_handle
.
setSkip
(
false
);
getCalloutManager
()
->
callCallouts
(
alpha_index_
,
callout_handle
);
EXPECT_FALSE
(
callout_handle
.
getSkip
());
// Set the skip flag and call a hook with no callouts.
callout_handle
.
setSkip
(
true
);
getCalloutManager
()
->
callCallouts
(
alpha_index_
,
callout_handle
);
EXPECT_FALSE
(
callout_handle
.
getSkip
());
}
// The next set of callouts do a similar thing to the above "skip" tests,
// but alter the value of a string argument. This is for testing that the
// a callout is able to change an argument and return it to the caller.
...
...
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