Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
b92387af
Commit
b92387af
authored
4 months ago
by
François-Simon Fauteux-Chapleau
Browse files
Options
Downloads
Patches
Plain Diff
turn_cache: fix memory leak
GitLab:
#632
Change-Id: I54a9e41f1cd026183a0fa3aa0891e49e99785517
parent
dc96183f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/turn/turn_cache.cpp
+10
-2
10 additions, 2 deletions
src/turn/turn_cache.cpp
with
10 additions
and
2 deletions
src/turn/turn_cache.cpp
+
10
−
2
View file @
b92387af
...
...
@@ -191,7 +191,11 @@ TurnCache::testTurn(IpAddr server)
std
::
lock_guard
lock
(
shutdownMtx_
);
if
(
onConnectedTimer_
)
{
onConnectedTimer_
->
expires_at
(
std
::
chrono
::
steady_clock
::
now
());
onConnectedTimer_
->
async_wait
(
std
::
bind
(
&
TurnCache
::
onConnected
,
shared_from_this
(),
std
::
placeholders
::
_1
,
ok
,
server
));
onConnectedTimer_
->
async_wait
([
w
=
weak_from_this
(),
ok
,
server
](
const
asio
::
error_code
&
ec
)
{
if
(
auto
shared
=
w
.
lock
())
{
shared
->
onConnected
(
ec
,
ok
,
server
);
}
});
}
});
}
catch
(
const
std
::
exception
&
e
)
{
...
...
@@ -229,7 +233,11 @@ TurnCache::refreshTurnDelay(bool scheduleNext)
if
(
logger_
)
logger_
->
warn
(
"[Account {:s}] Cache for TURN resolution failed."
,
accountId_
);
if
(
refreshTimer_
)
{
refreshTimer_
->
expires_at
(
std
::
chrono
::
steady_clock
::
now
()
+
turnRefreshDelay_
);
refreshTimer_
->
async_wait
(
std
::
bind
(
&
TurnCache
::
refresh
,
shared_from_this
(),
std
::
placeholders
::
_1
));
refreshTimer_
->
async_wait
([
w
=
weak_from_this
()](
const
asio
::
error_code
&
ec
)
{
if
(
auto
shared
=
w
.
lock
())
{
shared
->
refresh
(
ec
);
}
});
}
if
(
turnRefreshDelay_
<
std
::
chrono
::
minutes
(
30
))
turnRefreshDelay_
*=
2
;
...
...
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