Skip to content
GitLab
Explore
Sign in
Register
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
c7f3c313
Commit
c7f3c313
authored
4 years ago
by
Adrien Béraud
Committed by
Sébastien Blin
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
call: hangup subcalls on io thread
Change-Id: Id382d9c31b62c233af3561f0f33132d1a346e0d8
parent
bb3ca5bb
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/call.cpp
+14
-17
14 additions, 17 deletions
src/call.cpp
with
14 additions
and
17 deletions
src/call.cpp
+
14
−
17
View file @
c7f3c313
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#include
"errno.h"
#include
"errno.h"
#include
<opendht/thread_pool.h>
#include
<stdexcept>
#include
<stdexcept>
#include
<system_error>
#include
<system_error>
#include
<algorithm>
#include
<algorithm>
...
@@ -50,33 +52,28 @@ namespace jami {
...
@@ -50,33 +52,28 @@ namespace jami {
/// calls the unary predicate \a pred with this call pointer and hangup the call with given error
/// calls the unary predicate \a pred with this call pointer and hangup the call with given error
/// code \a errcode when the predicate return true.
/// code \a errcode when the predicate return true.
/// The predicate should have <code>bool(Call*) signature</code>.
/// The predicate should have <code>bool(Call*) signature</code>.
template
<
typename
T
>
inline
void
inline
void
hangupCallsIf
(
const
Call
::
SubcallSet
&
call
ptr_list
,
hangupCallsIf
(
Call
::
SubcallSet
&
&
call
s
,
int
errcode
,
int
errcode
,
const
std
::
function
<
bool
(
Call
*
)
>&
pred
)
T
pred
)
{
{
std
::
for_each
(
std
::
begin
(
callptr_list
),
for
(
auto
&
call
:
calls
)
{
std
::
end
(
callptr_list
),
if
(
not
pred
(
call
.
get
()))
[
&
](
const
std
::
shared_ptr
<
Call
>&
call_ptr
)
{
continue
;
if
(
pred
(
call_ptr
.
get
()))
{
dht
::
ThreadPool
::
io
().
run
([
call
=
std
::
move
(
call
),
errcode
]
{
try
{
call
->
hangup
(
errcode
);
call_ptr
->
hangup
(
errcode
);
}
catch
(
const
std
::
exception
&
e
)
{
JAMI_ERR
(
"[call:%s] hangup failed: %s"
,
call_ptr
->
getCallId
().
c_str
(),
e
.
what
());
}
}
});
});
}
}
}
/// Hangup many calls with same error code.
/// Hangup many calls with same error code.
///
///
/// Works as hangupCallsIf() with a predicate that always return true.
/// Works as hangupCallsIf() with a predicate that always return true.
inline
void
inline
void
hangupCalls
(
const
Call
::
SubcallSet
&
callptr_list
,
int
errcode
)
hangupCalls
(
Call
::
SubcallSet
&
&
callptr_list
,
int
errcode
)
{
{
hangupCallsIf
(
callptr_list
,
errcode
,
[](
Call
*
)
{
return
true
;
});
hangupCallsIf
(
std
::
move
(
callptr_list
)
,
errcode
,
[](
Call
*
)
{
return
true
;
});
}
}
//==============================================================================
//==============================================================================
...
...
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