Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
882b2ad0
Commit
882b2ad0
authored
6 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug27003_034_v2' into maint-0.3.4
parents
a54e9487
176999fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changes/bug27003
+6
-0
6 additions, 0 deletions
changes/bug27003
src/or/periodic.c
+5
-4
5 additions, 4 deletions
src/or/periodic.c
src/test/test_periodic_event.c
+2
-6
2 additions, 6 deletions
src/test/test_periodic_event.c
with
13 additions
and
10 deletions
changes/bug27003
0 → 100644
+
6
−
0
View file @
882b2ad0
o Major bugfixes (event scheduler):
- When we enable a periodic event, schedule it in the event loop
rather than running it immediately. Previously, we would re-run
periodic events immediately in the middle of (for example)
changing our options, with unpredictable effects. Fixes bug
27003; bugfix on 0.3.4.1-alpha.
This diff is collapsed.
Click to expand it.
src/or/periodic.c
+
5
−
4
View file @
882b2ad0
...
...
@@ -140,8 +140,8 @@ periodic_event_destroy(periodic_event_item_t *event)
event
->
last_action_time
=
0
;
}
/** Enable the given event
which means the event
is
launched and then the
*
event's enabled flag is set
. This can be called for an event that is
/** Enable the given event
by setting
i
t
s
"enabled" flag and scheduling it to
*
run immediately in the event loop
. This can be called for an event that is
* already enabled. */
void
periodic_event_enable
(
periodic_event_item_t
*
event
)
...
...
@@ -152,7 +152,9 @@ periodic_event_enable(periodic_event_item_t *event)
return
;
}
periodic_event_launch
(
event
);
tor_assert
(
event
->
ev
);
event
->
enabled
=
1
;
mainloop_event_activate
(
event
->
ev
);
}
/** Disable the given event which means the event is destroyed and then the
...
...
@@ -169,4 +171,3 @@ periodic_event_disable(periodic_event_item_t *event)
mainloop_event_cancel
(
event
->
ev
);
event
->
enabled
=
0
;
}
This diff is collapsed.
Click to expand it.
src/test/test_periodic_event.c
+
2
−
6
View file @
882b2ad0
...
...
@@ -106,11 +106,11 @@ test_pe_launch(void *arg)
periodic_event_item_t
*
item
=
&
periodic_events
[
i
];
if
(
item
->
roles
&
PERIODIC_EVENT_ROLE_CLIENT
)
{
tt_int_op
(
periodic_event_is_enabled
(
item
),
OP_EQ
,
1
);
tt_u64_op
(
item
->
last_action_time
,
OP_NE
,
0
);
}
else
{
tt_int_op
(
periodic_event_is_enabled
(
item
),
OP_EQ
,
0
);
tt_u64_op
(
item
->
last_action_time
,
OP_EQ
,
0
);
}
// enabled or not, the event has not yet been run.
tt_u64_op
(
item
->
last_action_time
,
OP_EQ
,
0
);
}
/* Remove Client but become a Relay. */
...
...
@@ -127,12 +127,9 @@ test_pe_launch(void *arg)
/* Only Client role should be disabled. */
if
(
item
->
roles
==
PERIODIC_EVENT_ROLE_CLIENT
)
{
tt_int_op
(
periodic_event_is_enabled
(
item
),
OP_EQ
,
0
);
/* Was previously enabled so they should never be to 0. */
tt_u64_op
(
item
->
last_action_time
,
OP_NE
,
0
);
}
if
(
item
->
roles
&
PERIODIC_EVENT_ROLE_RELAY
)
{
tt_int_op
(
periodic_event_is_enabled
(
item
),
OP_EQ
,
1
);
tt_u64_op
(
item
->
last_action_time
,
OP_NE
,
0
);
}
/* Non Relay role should be disabled, except for Dirserver. */
if
(
!
(
item
->
roles
&
roles
))
{
...
...
@@ -330,4 +327,3 @@ struct testcase_t periodic_event_tests[] = {
END_OF_TESTCASES
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment