Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Jonathan Coetzee
Knot Resolver
Commits
7ad4c9a0
Commit
7ad4c9a0
authored
Nov 03, 2015
by
Marek Vavruša
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
daemon: fixed race condition when canceling one event multiple times
parent
f8636079
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
daemon/bindings.c
daemon/bindings.c
+6
-2
daemon/lua/trust_anchors.lua
daemon/lua/trust_anchors.lua
+1
-1
No files found.
daemon/bindings.c
View file @
7ad4c9a0
...
...
@@ -495,7 +495,9 @@ static void event_callback(uv_timer_t *timer)
int
ret
=
execute_callback
(
L
,
1
);
/* Free callback if not recurrent or an error */
if
(
ret
!=
0
||
uv_timer_get_repeat
(
timer
)
==
0
)
{
uv_close
((
uv_handle_t
*
)
timer
,
(
uv_close_cb
)
event_free
);
if
(
!
uv_is_closing
((
uv_handle_t
*
)
timer
))
{
uv_close
((
uv_handle_t
*
)
timer
,
(
uv_close_cb
)
event_free
);
}
}
}
...
...
@@ -572,7 +574,9 @@ static int event_cancel(lua_State *L)
/* Close the timer */
lua_rawgeti
(
L
,
-
1
,
2
);
uv_handle_t
*
timer
=
lua_touserdata
(
L
,
-
1
);
uv_close
(
timer
,
(
uv_close_cb
)
event_free
);
if
(
!
uv_is_closing
(
timer
))
{
uv_close
(
timer
,
(
uv_close_cb
)
event_free
);
}
lua_pushboolean
(
L
,
true
);
return
1
;
}
...
...
daemon/lua/trust_anchors.lua
View file @
7ad4c9a0
...
...
@@ -89,7 +89,6 @@ end
-- Plan refresh event and re-schedule itself based on the result of the callback
local
function
refresh_plan
(
trust_anchors
,
timeout
,
refresh_cb
)
if
trust_anchors
.
refresh_ev
~=
nil
then
event
.
cancel
(
trust_anchors
.
refresh_ev
)
end
trust_anchors
.
refresh_ev
=
event
.
after
(
timeout
,
function
(
ev
)
resolve
(
'.'
,
kres
.
type
.
DNSKEY
,
kres
.
class
.
IN
,
kres
.
query
.
NO_CACHE
,
function
(
pkt
)
...
...
@@ -198,6 +197,7 @@ local trust_anchors = {
if
is_unmanaged
then
trust_anchors
.
file_current
=
nil
end
trust_anchors
.
keyset
=
{}
if
trust_anchors
.
update
(
new_keys
,
true
)
then
if
trust_anchors
.
refresh_ev
~=
nil
then
event
.
cancel
(
trust_anchors
.
refresh_ev
)
end
refresh_plan
(
trust_anchors
,
sec
,
active_refresh
)
end
end
,
...
...
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