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
2bc4c348
Commit
2bc4c348
authored
3 months ago
by
Adrien Béraud
Committed by
Adrien Béraud
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
connectionmanager: destroy ICE transport after unlock
Change-Id: I39a23e0e983716bb5fd6ac615aca57cd7d2575c1
parent
e7ed15d5
Branches
Branches containing commit
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/connectionmanager.cpp
+24
-15
24 additions, 15 deletions
src/connectionmanager.cpp
with
24 additions
and
15 deletions
src/connectionmanager.cpp
+
24
−
15
View file @
2bc4c348
...
...
@@ -980,7 +980,10 @@ ConnectionManager::Impl::startConnection(const std::shared_ptr<DeviceInfo>& di,
auto
eraseInfo
=
[
w
=
weak_from_this
(),
diw
=
std
::
weak_ptr
(
di
),
vid
]
{
if
(
auto
di
=
diw
.
lock
())
{
std
::
unique_lock
lk
(
di
->
mutex_
);
if
(
di
->
info
.
erase
(
vid
))
{
auto
it
=
di
->
info
.
find
(
vid
);
if
(
it
!=
di
->
info
.
end
())
{
// destroy at the end of the scope to avoid blocking the mutex
auto
ci_node
=
di
->
info
.
extract
(
it
);
auto
ops
=
di
->
extractPendingOperations
(
vid
,
nullptr
);
if
(
di
->
empty
())
{
if
(
auto
shared
=
w
.
lock
())
...
...
@@ -1458,7 +1461,10 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req,
auto
shared
=
w
.
lock
();
if
(
auto
di
=
wdi
.
lock
())
{
std
::
unique_lock
lk
(
di
->
mutex_
);
di
->
info
.
erase
(
id
);
auto
it
=
di
->
info
.
find
(
id
);
if
(
it
!=
di
->
info
.
end
())
{
// destroy at the end of the scope to avoid blocking the mutex
auto
ci_node
=
di
->
info
.
extract
(
it
);
auto
ops
=
di
->
extractPendingOperations
(
id
,
nullptr
);
if
(
di
->
empty
())
{
if
(
shared
)
...
...
@@ -1470,6 +1476,7 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req,
if
(
shared
&&
shared
->
connReadyCb_
)
shared
->
connReadyCb_
(
di
->
deviceId
,
""
,
nullptr
);
}
}
};
ice_config
.
master
=
true
;
...
...
@@ -1700,8 +1707,8 @@ ConnectionManager::Impl::storeActiveIpAddress(std::function<void()>&& cb)
if
(
hasIpv4
and
hasIpv6
)
break
;
}
dht
::
ThreadPool
::
io
().
run
([
cb
=
std
::
move
(
cb
)]
{
if
(
cb
)
dht
::
ThreadPool
::
io
().
run
([
cb
=
std
::
move
(
cb
)]
{
cb
();
});
});
...
...
@@ -2062,7 +2069,9 @@ ConnectionManager::getConnectionList(const DeviceId& device) const
connectionsList
=
deviceInfo
->
getConnectionList
(
pimpl_
->
certStore
());
}
}
else
{
for
(
const
auto
&
deviceInfo
:
pimpl_
->
infos_
.
getDeviceInfos
())
{
auto
deviceInfos
=
pimpl_
->
infos_
.
getDeviceInfos
();
connectionsList
.
reserve
(
deviceInfos
.
size
());
for
(
const
auto
&
deviceInfo
:
deviceInfos
)
{
auto
cl
=
deviceInfo
->
getConnectionList
(
pimpl_
->
certStore
());
connectionsList
.
insert
(
connectionsList
.
end
(),
std
::
make_move_iterator
(
cl
.
begin
()),
std
::
make_move_iterator
(
cl
.
end
()));
}
...
...
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