mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
don't cancel an http request that is already terminated
This commit is contained in:
parent
b4eebd1085
commit
489a5f3b8e
2 changed files with 12 additions and 13 deletions
|
|
@ -335,7 +335,7 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
|
|||
call->state == LinphoneCallPaused || call->state == LinphoneCallPausing ||
|
||||
call->state == LinphoneCallPausedByRemote) {
|
||||
ms_message("send SIP msg through the existing call.");
|
||||
op = sal_op_ref(call->op);
|
||||
op = call->op;
|
||||
identity = linphone_core_find_best_identity(cr->lc, linphone_call_get_remote_address(call));
|
||||
}
|
||||
}
|
||||
|
|
@ -1090,7 +1090,6 @@ static void linphone_chat_message_release(LinphoneChatMessage *msg) {
|
|||
if (msg->file_transfer_information != NULL) {
|
||||
linphone_chat_message_cancel_file_transfer(msg);
|
||||
}
|
||||
|
||||
/*mark the chat msg as orphan (it has no chat room anymore), and unref it*/
|
||||
msg->chat_room = NULL;
|
||||
linphone_chat_message_unref(msg);
|
||||
|
|
|
|||
|
|
@ -35,17 +35,6 @@ static bool_t file_transfer_in_progress_and_valid(LinphoneChatMessage* msg) {
|
|||
|
||||
static void _release_http_request(LinphoneChatMessage* msg) {
|
||||
if (msg->http_request) {
|
||||
if (!belle_http_request_is_cancelled(msg->http_request)) {
|
||||
if (msg->chat_room) {
|
||||
ms_message("Canceling file transfer %s - msg [%p] chat room[%p]"
|
||||
, (msg->external_body_url == NULL) ? linphone_core_get_file_transfer_server(msg->chat_room->lc) : msg->external_body_url
|
||||
, msg
|
||||
, msg->chat_room);
|
||||
belle_http_provider_cancel_request(msg->chat_room->lc->http_provider, msg->http_request);
|
||||
} else {
|
||||
ms_message("Warning: http request still running for ORPHAN msg [%p]: this is a memory leak", msg);
|
||||
}
|
||||
}
|
||||
belle_sip_object_unref(msg->http_request);
|
||||
msg->http_request = NULL;
|
||||
if (msg->http_listener){
|
||||
|
|
@ -527,6 +516,17 @@ void linphone_chat_message_start_file_download(LinphoneChatMessage *msg,
|
|||
void linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg) {
|
||||
if (msg->http_request) {
|
||||
linphone_chat_message_set_state(msg, LinphoneChatMessageStateNotDelivered);
|
||||
if (!belle_http_request_is_cancelled(msg->http_request)) {
|
||||
if (msg->chat_room) {
|
||||
ms_message("Canceling file transfer %s - msg [%p] chat room[%p]"
|
||||
, (msg->external_body_url == NULL) ? linphone_core_get_file_transfer_server(msg->chat_room->lc) : msg->external_body_url
|
||||
, msg
|
||||
, msg->chat_room);
|
||||
belle_http_provider_cancel_request(msg->chat_room->lc->http_provider, msg->http_request);
|
||||
} else {
|
||||
ms_message("Warning: http request still running for ORPHAN msg [%p]: this is a memory leak", msg);
|
||||
}
|
||||
}
|
||||
_release_http_request(msg);
|
||||
} else {
|
||||
ms_message("No existing file transfer - nothing to cancel");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue