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
485806b5
Commit
485806b5
authored
Nov 16, 2015
by
Simon Morlat
Browse files
fix crashes around presence support. This patch was extracted from 2 commits in master branch.
parent
67f7eaa7
Changes
5
Hide whitespace changes
Inline
Side-by-side
coreapi/bellesip_sal/sal_impl.h
View file @
485806b5
...
...
@@ -109,6 +109,7 @@ struct SalOp{
bool_t
manual_refresher
;
bool_t
has_auth_pending
;
bool_t
supports_session_timers
;
bool_t
op_released
;
};
...
...
coreapi/bellesip_sal/sal_op_impl.c
View file @
485806b5
...
...
@@ -38,6 +38,7 @@ void sal_op_release(SalOp *op){
if
(
op
->
refresher
)
{
belle_sip_refresher_stop
(
op
->
refresher
);
}
op
->
op_released
=
TRUE
;
sal_op_unref
(
op
);
}
...
...
coreapi/bellesip_sal/sal_op_presence.c
View file @
485806b5
...
...
@@ -55,7 +55,9 @@ static void presence_process_dialog_terminated(void *ctx, const belle_sip_dialog
if
(
op
->
dialog
)
{
if
(
belle_sip_dialog_is_server
(
op
->
dialog
)){
ms_message
(
"Incoming subscribtion from [%s] terminated"
,
sal_op_get_from
(
op
));
op
->
base
.
root
->
callbacks
.
subscribe_presence_closed
(
op
,
sal_op_get_from
(
op
));
if
(
!
op
->
op_released
){
op
->
base
.
root
->
callbacks
.
subscribe_presence_closed
(
op
,
sal_op_get_from
(
op
));
}
}
set_or_update_dialog
(
op
,
NULL
);
}
...
...
@@ -98,7 +100,9 @@ static void presence_response_event(void *op_base, const belle_sip_response_even
if
(
code
>=
300
)
{
if
(
strcmp
(
"SUBSCRIBE"
,
belle_sip_request_get_method
(
request
))
==
0
){
ms_message
(
"subscription to [%s] rejected"
,
sal_op_get_to
(
op
));
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
SalSubscribeTerminated
,
NULL
,
NULL
);
/*NULL = offline*/
if
(
!
op
->
op_released
){
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
SalSubscribeTerminated
,
NULL
,
NULL
);
/*NULL = offline*/
}
return
;
}
}
...
...
@@ -156,7 +160,9 @@ static void presence_process_timeout(void *user_ctx, const belle_sip_timeout_eve
if
(
strcmp
(
"SUBSCRIBE"
,
belle_sip_request_get_method
(
request
))
==
0
){
ms_message
(
"subscription to [%s] timeout"
,
sal_op_get_to
(
op
));
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
SalSubscribeTerminated
,
NULL
,
NULL
);
/*NULL = offline*/
if
(
!
op
->
op_released
){
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
SalSubscribeTerminated
,
NULL
,
NULL
);
/*NULL = offline*/
}
}
}
...
...
@@ -176,12 +182,13 @@ static SalPresenceModel * process_presence_notification(SalOp *op, belle_sip_req
return
NULL
;
if
(
body
==
NULL
)
return
NULL
;
op
->
base
.
root
->
callbacks
.
parse_presence_requested
(
op
,
if
(
!
op
->
op_released
){
op
->
base
.
root
->
callbacks
.
parse_presence_requested
(
op
,
belle_sip_header_content_type_get_type
(
content_type
),
belle_sip_header_content_type_get_subtype
(
content_type
),
body
,
&
result
);
}
return
result
;
}
...
...
@@ -210,7 +217,9 @@ static void handle_notify(SalOp *op, belle_sip_request_t *req, belle_sip_dialog_
/* Presence notification body parsed successfully. */
resp
=
sal_op_create_response_from_request
(
op
,
req
,
200
);
/*create first because the op may be destroyed by notify_presence */
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
sub_state
,
presence_model
,
NULL
);
if
(
!
op
->
op_released
){
op
->
base
.
root
->
callbacks
.
notify_presence
(
op
,
sub_state
,
presence_model
,
NULL
);
}
}
else
if
(
body
){
/* Formatting error in presence notification body. */
ms_warning
(
"Wrongly formatted presence document."
);
...
...
coreapi/callbacks.c
View file @
485806b5
...
...
@@ -1058,6 +1058,7 @@ static void vfu_request(SalOp *op){
static
void
dtmf_received
(
SalOp
*
op
,
char
dtmf
){
LinphoneCore
*
lc
=
(
LinphoneCore
*
)
sal_get_user_pointer
(
sal_op_get_sal
(
op
));
LinphoneCall
*
call
=
(
LinphoneCall
*
)
sal_op_get_user_pointer
(
op
);
if
(
!
call
)
return
;
linphone_core_notify_dtmf_received
(
lc
,
call
,
dtmf
);
}
...
...
coreapi/presence.c
View file @
485806b5
...
...
@@ -1888,10 +1888,17 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
return
;
}
if
(
ss
==
SalSubscribeTerminated
){
sal_op_release
(
op
);
if
(
lf
){
lf
->
outsub
=
NULL
;
if
(
lf
->
outsub
!=
op
){
sal_op_release
(
op
);
}
if
(
lf
->
outsub
){
sal_op_release
(
lf
->
outsub
);
lf
->
outsub
=
NULL
;
}
lf
->
subscribe_active
=
FALSE
;
}
else
{
sal_op_release
(
op
);
}
}
}
...
...
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