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
cd512073
Commit
cd512073
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
upnp: unlock mutex after use, cleanup
Change-Id: I9b440d96fc34e9442b7856e428190cc8110f6bfa
parent
852bd075
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/upnp_context.cpp
+3
-3
3 additions, 3 deletions
src/upnp/upnp_context.cpp
with
3 additions
and
3 deletions
src/upnp/upnp_context.cpp
+
3
−
3
View file @
cd512073
...
...
@@ -958,7 +958,7 @@ UPnPContext::handleUPnPEvents(Upnp_EventType event_type, const void* event)
JAMI_DBG("UPnP: CP received a discovery search result"); */
/* check if we are already in the process of checking this device */
std
::
lock_guard
<
std
::
mutex
>
lock
(
cpDeviceMutex_
);
std
::
unique_lock
<
std
::
mutex
>
lock
(
cpDeviceMutex_
);
/*
* Check if this device ID is already in the list. If we reach the past-the-end
...
...
@@ -969,6 +969,7 @@ UPnPContext::handleUPnPEvents(Upnp_EventType event_type, const void* event)
if
(
it
==
cpDevices_
.
end
())
{
JAMI_DBG
(
"PUPnP: New device ID found -> %s."
,
deviceId
.
c_str
());
cpDevices_
.
emplace
(
deviceId
);
lock
.
unlock
();
if
(
UpnpDiscovery_get_ErrCode
(
d_event
)
!=
UPNP_E_SUCCESS
)
JAMI_WARN
(
"UPnP: Error in discovery event received by the CP: %s"
,
...
...
@@ -996,7 +997,7 @@ UPnPContext::handleUPnPEvents(Upnp_EventType event_type, const void* event)
}
else
{
parseDevice
(
desc_doc
.
get
(),
d_event
);
}
}
}
}
break
;
...
...
@@ -1011,7 +1012,6 @@ UPnPContext::handleUPnPEvents(Upnp_EventType event_type, const void* event)
JAMI_WARN
(
"UPnP: Error in ByeBye received by the CP: %s"
,
UpnpGetErrorMessage
(
UpnpDiscovery_get_ErrCode
(
d_event
)));
/* TODO: check if its a device we care about and remove it from the relevant lists */
std
::
lock_guard
<
std
::
mutex
>
lock
(
cpDeviceMutex_
);
std
::
string
deviceId
(
UpnpDiscovery_get_DeviceID_cstr
(
d_event
));
cpDevices_
.
erase
(
deviceId
);
...
...
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