Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
dd9fdf60
Commit
dd9fdf60
authored
Feb 02, 2021
by
Ivan Vilata-i-Balaguer
Browse files
Better rounding of UPnP pauses, avoid gaps in mapping availability.
parent
c1ba8f64
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/upnp.h
View file @
dd9fdf60
...
...
@@ -133,13 +133,14 @@ private:
// but only if we just got to add mappings to buggy IGDs.
if
(
!
earlier_buggy_timeout
)
return
failure_wait_time
;
auto
now
=
steady_clock
::
now
();
if
(
*
earlier_buggy_timeout
<=
now
)
return
timeout_pause
;
return
duration_cast
<
seconds
>
(
*
earlier_buggy_timeout
-
now
+
timeout_pause
);
auto
buggy_refresh
=
*
earlier_buggy_timeout
+
timeout_pause
;
if
(
buggy_refresh
<
now
)
return
seconds
(
0
);
return
ceil
<
seconds
>
(
buggy_refresh
-
now
);
}
// Wait until a little before mappings would time out to refresh them.
auto
round_elapsed
=
steady_clock
::
now
()
-
round_begin
;
if
(
round_elapsed
>=
success_wait_time
)
return
seconds
(
0
);
return
success_wait_time
-
duration_cast
<
seconds
>
(
round_elapsed
);
return
duration_cast
<
seconds
>
(
success_wait_time
-
round_elapsed
);
}();
async_sleep
(
exec
,
wait_time
,
cancel
,
yield
);
...
...
Write
Preview
Supports
Markdown
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