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
121c0d45
Commit
121c0d45
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
pupnp: start thread after init
Change-Id: Ie05bd2b1ecdd89ca1134e9fc4dde91b5845435d3
parent
bf1dfb91
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/pupnp/pupnp.cpp
+36
-36
36 additions, 36 deletions
src/upnp/protocol/pupnp/pupnp.cpp
with
36 additions
and
36 deletions
src/upnp/protocol/pupnp/pupnp.cpp
+
36
−
36
View file @
121c0d45
...
...
@@ -83,6 +83,42 @@ errorOnResponse(IXML_Document* doc)
PUPnP
::
PUPnP
()
{
int
upnp_err
=
UPNP_E_SUCCESS
;
#if UPNP_ENABLE_IPV6
upnp_err
=
UpnpInit2
(
0
,
0
);
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_WARN
(
"PUPnP: UpnpInit2 Failed to initialize"
);
UpnpFinish
();
// Destroy threads before reusing upnp init function.
upnp_err
=
UpnpInit
(
0
,
0
);
// Deprecated function but fall back on it if UpnpInit2 fails.
}
#else
upnp_err
=
UpnpInit
(
0
,
0
);
// Deprecated function but fall back on it if IPv6 not enabled.
#endif
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_ERR
(
"PUPnP: Can't initialize libupnp: %s"
,
UpnpGetErrorMessage
(
upnp_err
));
UpnpFinish
();
pupnpRun_
=
false
;
return
;
}
else
{
char
*
ip_address
=
UpnpGetServerIpAddress
();
char
*
ip_address6
=
nullptr
;
unsigned
short
port
=
UpnpGetServerPort
();
unsigned
short
port6
=
0
;
#if UPNP_ENABLE_IPV6
ip_address6
=
UpnpGetServerIp6Address
();
port6
=
UpnpGetServerPort6
();
#endif
if
(
ip_address6
and
port6
)
JAMI_DBG
(
"PUPnP: Initialiazed on %s:%u | %s:%u"
,
ip_address
,
port
,
ip_address6
,
port6
);
else
JAMI_DBG
(
"PUPnP: Initialiazed on %s:%u"
,
ip_address
,
port
);
// Relax the parser to allow malformed XML text.
ixmlRelaxParser
(
1
);
}
pupnpThread_
=
std
::
thread
([
this
]
{
std
::
unique_lock
<
std
::
mutex
>
lk
(
ctrlptMutex_
);
while
(
pupnpRun_
)
{
...
...
@@ -150,42 +186,6 @@ PUPnP::PUPnP()
UpnpFinish
();
});
int
upnp_err
=
UPNP_E_SUCCESS
;
char
*
ip_address
=
nullptr
;
char
*
ip_address6
=
nullptr
;
unsigned
short
port
=
0
;
unsigned
short
port6
=
0
;
#if UPNP_ENABLE_IPV6
upnp_err
=
UpnpInit2
(
0
,
0
);
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_WARN
(
"PUPnP: UpnpInit2 Failed to initialize"
);
UpnpFinish
();
// Destroy threads before reusing upnp init function.
upnp_err
=
UpnpInit
(
0
,
0
);
// Deprecated function but fall back on it if UpnpInit2 fails.
}
#else
upnp_err
=
UpnpInit
(
0
,
0
);
// Deprecated function but fall back on it if IPv6 not enabled.
#endif
if
(
upnp_err
!=
UPNP_E_SUCCESS
)
{
JAMI_ERR
(
"PUPnP: Can't initialize libupnp: %s"
,
UpnpGetErrorMessage
(
upnp_err
));
UpnpFinish
();
}
else
{
ip_address
=
UpnpGetServerIpAddress
();
port
=
UpnpGetServerPort
();
#if UPNP_ENABLE_IPV6
ip_address6
=
UpnpGetServerIp6Address
();
port6
=
UpnpGetServerPort6
();
#endif
if
(
ip_address6
and
port6
)
JAMI_DBG
(
"PUPnP: Initialiazed on %s:%u | %s:%u"
,
ip_address
,
port
,
ip_address6
,
port6
);
else
JAMI_DBG
(
"PUPnP: Initialiazed on %s:%u"
,
ip_address
,
port
);
// Relax the parser to allow malformed XML text.
ixmlRelaxParser
(
1
);
}
}
PUPnP
::~
PUPnP
()
...
...
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