From da0cc3423be84f7b7d6b0ab1d83b98b3ed2d92a0 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 6 Oct 2015 18:31:32 +0200 Subject: [PATCH] prevent application to perform concurrent download/upload on a single chat message by accident --- coreapi/chat_file_transfer.c | 9 +++++++++ coreapi/linphonecore.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/coreapi/chat_file_transfer.c b/coreapi/chat_file_transfer.c index 11394d6ca..74cd69230 100644 --- a/coreapi/chat_file_transfer.c +++ b/coreapi/chat_file_transfer.c @@ -491,6 +491,11 @@ int linphone_chat_room_upload_file(LinphoneChatMessage *msg) { belle_http_request_listener_callbacks_t cbs = {0}; int err; + if (msg->http_request){ + ms_error("linphone_chat_room_upload_file(): there is already an upload in progress."); + return -1; + } + cbs.process_response = linphone_chat_message_process_response_from_post_file; cbs.process_io_error = linphone_chat_message_process_io_error_upload; cbs.process_auth_requested = linphone_chat_message_process_auth_requested_upload; @@ -505,6 +510,10 @@ int linphone_chat_message_download_file(LinphoneChatMessage *msg) { belle_http_request_listener_callbacks_t cbs = {0}; int err; + if (msg->http_request){ + ms_error("linphone_chat_message_download_file(): there is already a download in progress"); + return -1; + } cbs.process_response_headers = linphone_chat_process_response_headers_from_get_file; cbs.process_response = linphone_chat_process_response_from_get_file; cbs.process_io_error = linphone_chat_message_process_io_error_download; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 56ebcb397..d5c7d5f74 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -929,7 +929,7 @@ LINPHONE_PUBLIC int linphone_call_get_stream_count(LinphoneCall *call); * @param call * @param stream_index * - * @return MsAudio if stream_index = 0, MsVideo otherwise + * @return the type (MSAudio, MSVideo, MSText) of the stream of given index. **/ LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index);