Commit 21825131 authored by DanmeiChen's avatar DanmeiChen
Browse files

stop file transfer background task

parent 8c3c1e6f
......@@ -1173,6 +1173,7 @@ ChatMessage::ChatMessage (ChatMessagePrivate &p) : Object(p), CoreAccessor(p.get
ChatMessage::~ChatMessage () {
L_D();
fileUploadEndBackgroundTask();
deleteChatMessageFromCache();
for (Content *content : d->contents) {
......@@ -1513,6 +1514,11 @@ int ChatMessage::putCharacter (uint32_t character) {
return 0;
}
void ChatMessage::fileUploadEndBackgroundTask () {
L_D();
d->fileTransferChatMessageModifier.fileUploadEndBackgroundTask();
}
std::ostream& operator<<(std::ostream& lhs, ChatMessage::State e) {
switch(e) {
case ChatMessage::State::Idle: lhs << "Idle"; break;
......
......@@ -142,6 +142,7 @@ public:
bool downloadFile (FileTransferContent *content);
bool isFileTransferInProgress () const;
void fileUploadEndBackgroundTask ();
protected:
explicit ChatMessage (ChatMessagePrivate &p);
......
......@@ -64,6 +64,7 @@ public:
void cancelFileTransfer ();
bool isFileTransferInProgressAndValid () const;
std::string createFakeFileTransferFromUrl (const std::string &url);
void fileUploadEndBackgroundTask ();
private:
// Body handler is optional, but if set this method takes owneship of it, even in error cases.
......@@ -71,7 +72,7 @@ private:
// Body handler is optional, but if set this method takes owneship of it, even in error cases.
int startHttpTransfer (const std::string &url, const std::string &action, belle_sip_body_handler_t *bh, belle_http_request_listener_callbacks_t *cbs);
void fileUploadBeginBackgroundTask ();
void fileUploadEndBackgroundTask ();
void onDownloadFailed ();
void releaseHttpRequest ();
......
......@@ -286,6 +286,11 @@ void CorePrivate::uninit() {
}
}
#endif
// end all file transfer background tasks before linphonecore off
const auto &chatRoomPrivate = cr->getPrivate();
for (auto &chatMessage : chatRoomPrivate->getTransientChatMessages()) {
chatMessage->fileUploadEndBackgroundTask();
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment