Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
5e7a6465
Commit
5e7a6465
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
upnp: make mapping operations atomic
Change-Id: I2c04e3831f68a55b7682c42eb93464e1fab78b1b
parent
a37e4631
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/mapping.cpp
+11
-27
11 additions, 27 deletions
src/upnp/protocol/mapping.cpp
with
11 additions
and
27 deletions
src/upnp/protocol/mapping.cpp
+
11
−
27
View file @
5e7a6465
...
...
@@ -43,7 +43,7 @@ Mapping::Mapping(PortType type, uint16_t portExternal, uint16_t portInternal, bo
Mapping
::
Mapping
(
const
Mapping
&
other
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
other
.
mutex_
);
internalAddr_
=
other
.
internalAddr_
;
internalPort_
=
other
.
internalPort_
;
...
...
@@ -95,17 +95,6 @@ Mapping::setAvailable(bool val)
void
Mapping
::
setState
(
const
MappingState
&
state
)
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
state_
==
state
)
return
;
}
JAMI_DBG
(
"Changed mapping %s state from %s to %s"
,
toString
().
c_str
(),
getStateStr
(),
getStateStr
(
state
));
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
state_
=
state
;
}
...
...
@@ -136,22 +125,17 @@ Mapping::toString(bool extraInfo) const
bool
Mapping
::
isValid
()
const
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
state_
==
MappingState
::
FAILED
)
return
false
;
if
(
internalPort_
==
0
)
return
false
;
if
(
externalPort_
==
0
)
return
false
;
if
(
not
igd_
or
not
igd_
->
isValid
())
return
false
;
}
if
(
not
hasValidHostAddress
())
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
state_
==
MappingState
::
FAILED
)
return
false
;
return
true
;
if
(
internalPort_
==
0
)
return
false
;
if
(
externalPort_
==
0
)
return
false
;
if
(
not
igd_
or
not
igd_
->
isValid
())
return
false
;
IpAddr
intAddr
(
internalAddr_
);
return
intAddr
and
not
intAddr
.
isLoopback
();
}
bool
...
...
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