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
belle-sip
Commits
e25ef850
Commit
e25ef850
authored
Jul 10, 2014
by
Guillaume BIENKOWSKI
Browse files
Use background task names when possible (ios7+) and use better names for them
parent
b29b6335
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
src/backgroundtask.m
src/backgroundtask.m
+11
-3
src/channel.c
src/channel.c
+2
-2
src/http-provider.c
src/http-provider.c
+1
-1
No files found.
src/backgroundtask.m
View file @
e25ef850
...
...
@@ -22,11 +22,19 @@
unsigned int belle_sip_begin_background_task(const char *name, belle_sip_background_task_end_callback_t cb, void *data){
UIApplication *app=[UIApplication sharedApplication];
UIBackgroundTaskIdentifier bgid=[app beginBackgroundTaskWithExpirationHandler:^{
UIBackgroundTaskIdentifier bgid = UIBackgroundTaskInvalid;
void (^handler)() = ^{
cb(data);
}];
};
if([app respondsToSelector:@selector(beginBackgroundTaskWithName:expirationHandler:)]){
bgid = [app beginBackgroundTaskWithName:[NSString stringWithUTF8String:name] expirationHandler:handler];
} else {
bgid = [app beginBackgroundTaskWithExpirationHandler:handler];
}
if (bgid==UIBackgroundTaskInvalid){
belle_sip_error("Could not start background task
."
);
belle_sip_error("Could not start background task
%s.", name
);
return 0;
}
return (unsigned int)bgid;
...
...
src/channel.c
View file @
e25ef850
...
...
@@ -768,7 +768,7 @@ static void channel_on_send_background_task_ended(belle_sip_channel_t *obj){
static
void
channel_begin_send_background_task
(
belle_sip_channel_t
*
obj
){
if
(
obj
->
bg_task_id
==
0
){
obj
->
bg_task_id
=
belle_sip_begin_background_task
(
"belle-sip channel
in progress
"
,(
void
(
*
)(
void
*
))
channel_on_send_background_task_ended
,
obj
);
obj
->
bg_task_id
=
belle_sip_begin_background_task
(
"belle-sip
send
channel"
,(
void
(
*
)(
void
*
))
channel_on_send_background_task_ended
,
obj
);
if
(
obj
->
bg_task_id
)
belle_sip_message
(
"channel [%p]: starting send background task with id=[%x]."
,
obj
,
obj
->
bg_task_id
);
}
}
...
...
@@ -788,7 +788,7 @@ static void channel_on_recv_background_task_ended(belle_sip_channel_t *obj){
static
void
channel_begin_recv_background_task
(
belle_sip_channel_t
*
obj
){
if
(
obj
->
recv_bg_task_id
==
0
){
obj
->
recv_bg_task_id
=
belle_sip_begin_background_task
(
"belle-sip channel
in progress
"
,(
void
(
*
)(
void
*
))
channel_on_recv_background_task_ended
,
obj
);
obj
->
recv_bg_task_id
=
belle_sip_begin_background_task
(
"belle-sip
recv
channel"
,(
void
(
*
)(
void
*
))
channel_on_recv_background_task_ended
,
obj
);
if
(
obj
->
recv_bg_task_id
)
belle_sip_message
(
"channel [%p]: starting recv background task with id=[%x]."
,
obj
,
obj
->
recv_bg_task_id
);
}
}
...
...
src/http-provider.c
View file @
e25ef850
...
...
@@ -405,7 +405,7 @@ int belle_http_provider_send_request(belle_http_provider_t *obj, belle_http_requ
fix_request
(
req
);
if
(
req
->
background_task_id
!=
0
){
req
->
background_task_id
=
belle_sip_begin_background_task
(
"http"
,
belle_http_end_background_task
,
req
);
req
->
background_task_id
=
belle_sip_begin_background_task
(
"
belle-sip
http"
,
belle_http_end_background_task
,
req
);
}
belle_sip_channel_queue_message
(
chan
,
BELLE_SIP_MESSAGE
(
req
));
...
...
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