Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
89e97799
Commit
89e97799
authored
Feb 04, 2016
by
jehan
Browse files
start long running task during tunnel udp link probing
parent
2f3c2491
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
coreapi/TunnelManager.cc
coreapi/TunnelManager.cc
+18
-2
coreapi/TunnelManager.hh
coreapi/TunnelManager.hh
+1
-0
No files found.
coreapi/TunnelManager.cc
View file @
89e97799
...
...
@@ -47,7 +47,10 @@ void TunnelManager::addServer(const char *ip, int port) {
void
TunnelManager
::
cleanServers
()
{
mServerAddrs
.
clear
();
if
(
mLongRunningTaskId
>
0
)
{
sal_end_background_task
(
mLongRunningTaskId
);
mLongRunningTaskId
=
0
;
}
UdpMirrorClientList
::
iterator
it
;
for
(
it
=
mUdpMirrorClients
.
begin
();
it
!=
mUdpMirrorClients
.
end
();)
{
UdpMirrorClient
&
s
=*
it
++
;
...
...
@@ -135,7 +138,8 @@ TunnelManager::TunnelManager(LinphoneCore* lc) :
mTunnelizeSipPackets
(
true
),
mTunnelClient
(
NULL
),
mHttpProxyPort
(
0
),
mVTable
(
NULL
)
mVTable
(
NULL
),
mLongRunningTaskId
(
0
)
{
linphone_core_add_iterate_hook
(
mCore
,(
LinphoneCoreIterateHook
)
sOnIterate
,
this
);
mTransportFactories
.
audio_rtcp_func
=
sCreateRtpTransport
;
...
...
@@ -153,6 +157,10 @@ TunnelManager::TunnelManager(LinphoneCore* lc) :
}
TunnelManager
::~
TunnelManager
(){
if
(
mLongRunningTaskId
>
0
)
{
sal_end_background_task
(
mLongRunningTaskId
);
mLongRunningTaskId
=
0
;
}
for
(
UdpMirrorClientList
::
iterator
udpMirror
=
mUdpMirrorClients
.
begin
();
udpMirror
!=
mUdpMirrorClients
.
end
();
udpMirror
++
)
{
udpMirror
->
stop
();
}
...
...
@@ -248,6 +256,10 @@ void TunnelManager::setMode(LinphoneTunnelMode mode) {
void
TunnelManager
::
tunnelCallback
(
bool
connected
,
TunnelManager
*
zis
){
Event
ev
;
if
(
zis
->
mLongRunningTaskId
>
0
)
{
sal_end_background_task
(
zis
->
mLongRunningTaskId
);
zis
->
mLongRunningTaskId
=
0
;
}
ev
.
mType
=
TunnelEvent
;
ev
.
mData
.
mConnected
=
connected
;
zis
->
postEvent
(
ev
);
...
...
@@ -334,6 +346,8 @@ void TunnelManager::processUdpMirrorEvent(const Event &ev){
mCurrentUdpMirrorClient
++
;
if
(
mCurrentUdpMirrorClient
!=
mUdpMirrorClients
.
end
())
{
ms_message
(
"TunnelManager: trying another UDP mirror"
);
if
(
mLongRunningTaskId
==
0
)
mLongRunningTaskId
=
sal_begin_background_task
(
"Tunnel auto detect"
,
NULL
,
NULL
);
UdpMirrorClient
&
lUdpMirrorClient
=*
mCurrentUdpMirrorClient
;
lUdpMirrorClient
.
start
(
TunnelManager
::
sUdpMirrorClientCallback
,(
void
*
)
this
);
}
else
{
...
...
@@ -378,6 +392,8 @@ bool TunnelManager::startAutoDetection() {
}
ms_message
(
"TunnelManager: Starting auto-detection"
);
mCurrentUdpMirrorClient
=
mUdpMirrorClients
.
begin
();
if
(
mLongRunningTaskId
==
0
)
mLongRunningTaskId
=
sal_begin_background_task
(
"Tunnel auto detect"
,
NULL
,
NULL
);
UdpMirrorClient
&
lUdpMirrorClient
=*
mCurrentUdpMirrorClient
;
lUdpMirrorClient
.
start
(
TunnelManager
::
sUdpMirrorClientCallback
,(
void
*
)
this
);
return
true
;
...
...
coreapi/TunnelManager.hh
View file @
89e97799
...
...
@@ -201,6 +201,7 @@ namespace belledonnecomm {
Mutex
mMutex
;
std
::
queue
<
Event
>
mEvq
;
char
mLocalAddr
[
64
];
unsigned
long
mLongRunningTaskId
;
};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment