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
a0683d18
Commit
a0683d18
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
upnp: cleanup
Change-Id: I3fc7888986e2cb17e591167f6b3893cf1c72a0ac
parent
a61adb53
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/upnp/upnp_context.cpp
+4
-7
4 additions, 7 deletions
src/upnp/upnp_context.cpp
with
4 additions
and
7 deletions
src/upnp/upnp_context.cpp
+
4
−
7
View file @
a0683d18
...
...
@@ -737,12 +737,12 @@ UPnPContext::pruneMappingList()
auto
remoteMapList
=
protocol
->
getMappingsListByDescr
(
igd
,
Mapping
::
UPNP_MAPPING_DESCRIPTION_PREFIX
);
if
(
remoteMapList
.
empty
())
{
/*
if (remoteMapList.empty()) {
std::lock_guard<std::mutex> lock(mappingMutex_);
if (not getMappingList(PortType::TCP).empty() or getMappingList(PortType::TCP).empty()) {
// JAMI_WARN("We have provisionned mappings but the PUPNP IGD returned an empty list!");
}
}
}
*/
pruneUnMatchedMappings
(
igd
,
remoteMapList
);
pruneUnTrackedMappings
(
igd
,
remoteMapList
);
...
...
@@ -755,15 +755,12 @@ UPnPContext::pruneUnMatchedMappings(const std::shared_ptr<IGD>& igd,
// Check/synchronize local mapping list with the list
// returned by the IGD.
PortType
types
[
2
]
{
PortType
::
TCP
,
PortType
::
UDP
};
for
(
auto
&
type
:
types
)
{
for
(
auto
type
:
{
PortType
::
TCP
,
PortType
::
UDP
})
{
// Use a temporary list to avoid processing mappings while holding the lock.
std
::
list
<
Mapping
::
sharedPtr_t
>
toRemoveList
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mappingMutex_
);
auto
&
mappingList
=
getMappingList
(
type
);
for
(
auto
const
&
[
_
,
map
]
:
mappingList
)
{
for
(
auto
const
&
[
_
,
map
]
:
getMappingList
(
type
))
{
// Only check mappings allocated by UPNP protocol.
if
(
map
->
getProtocol
()
!=
NatProtocolType
::
PUPNP
)
{
continue
;
...
...
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