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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
bf1dfb91
Commit
bf1dfb91
authored
Aug 11, 2019
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
pupnp: wait on condition
Change-Id: I053ca22980267a8e2fd04e73e9a0c1e4a1064248
parent
eb7bde60
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/pupnp/pupnp.cpp
+44
-35
44 additions, 35 deletions
src/upnp/protocol/pupnp/pupnp.cpp
with
44 additions
and
35 deletions
src/upnp/protocol/pupnp/pupnp.cpp
+
44
−
35
View file @
bf1dfb91
...
@@ -86,21 +86,29 @@ PUPnP::PUPnP()
...
@@ -86,21 +86,29 @@ PUPnP::PUPnP()
pupnpThread_
=
std
::
thread
([
this
]
{
pupnpThread_
=
std
::
thread
([
this
]
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
ctrlptMutex_
);
std
::
unique_lock
<
std
::
mutex
>
lk
(
ctrlptMutex_
);
while
(
pupnpRun_
)
{
while
(
pupnpRun_
)
{
pupnpCv_
.
wait
(
lk
);
pupnpCv_
.
wait
(
lk
,
[
this
]{
return
not
clientRegistered_
or
not
pupnpRun_
or
searchForIgd_
or
not
dwnldlXmlList_
.
empty
();
});
if
(
not
clientRegistered_
)
{
if
(
not
clientRegistered_
)
{
// Register Upnp control point.
// Register Upnp control point.
int
upnp_err
=
UpnpRegisterClient
(
ctrlPtCallback
,
this
,
&
ctrlptHandle_
);
int
upnp_err
=
UpnpRegisterClient
(
ctrlPtCallback
,
this
,
&
ctrlptHandle_
);
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_ERR
(
"PUPnP: Can't register client: %s"
,
UpnpGetErrorMessage
(
upnp_err
));
JAMI_ERR
(
"PUPnP: Can't register client: %s"
,
UpnpGetErrorMessage
(
upnp_err
));
else
pupnpRun_
=
false
;
break
;
}
else
clientRegistered_
=
true
;
clientRegistered_
=
true
;
}
}
if
(
not
pupnpRun_
)
if
(
not
pupnpRun_
)
break
;
break
;
if
(
clientRegistered_
and
searchForIgd_
)
{
if
(
clientRegistered_
)
{
if
(
searchForIgd_
)
{
// Send out search for multiple types of devices, as some routers may possibly only reply to one.
// Send out search for multiple types of devices, as some routers may possibly only reply to one.
UpnpSearchAsync
(
ctrlptHandle_
,
SEARCH_TIMEOUT
,
UPNP_ROOT_DEVICE
,
this
);
UpnpSearchAsync
(
ctrlptHandle_
,
SEARCH_TIMEOUT
,
UPNP_ROOT_DEVICE
,
this
);
UpnpSearchAsync
(
ctrlptHandle_
,
SEARCH_TIMEOUT
,
UPNP_IGD_DEVICE
,
this
);
UpnpSearchAsync
(
ctrlptHandle_
,
SEARCH_TIMEOUT
,
UPNP_IGD_DEVICE
,
this
);
...
@@ -111,7 +119,7 @@ PUPnP::PUPnP()
...
@@ -111,7 +119,7 @@ PUPnP::PUPnP()
searchForIgd_
=
false
;
searchForIgd_
=
false
;
}
}
if
(
clientRegistered_
)
{
if
(
not
dwnldlXmlList_
.
empty
()
)
{
auto
xmlList
=
std
::
move
(
dwnldlXmlList_
);
auto
xmlList
=
std
::
move
(
dwnldlXmlList_
);
decltype
(
xmlList
)
finished
{};
decltype
(
xmlList
)
finished
{};
...
@@ -138,6 +146,7 @@ PUPnP::PUPnP()
...
@@ -138,6 +146,7 @@ PUPnP::PUPnP()
}
}
}
}
}
}
}
UpnpFinish
();
UpnpFinish
();
});
});
...
...
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
sign in
to comment