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 ...@@ -1173,6 +1173,7 @@ ChatMessage::ChatMessage (ChatMessagePrivate &p) : Object(p), CoreAccessor(p.get
ChatMessage::~ChatMessage () { ChatMessage::~ChatMessage () {
L_D(); L_D();
fileUploadEndBackgroundTask();
deleteChatMessageFromCache(); deleteChatMessageFromCache();
for (Content *content : d->contents) { for (Content *content : d->contents) {
...@@ -1513,6 +1514,11 @@ int ChatMessage::putCharacter (uint32_t character) { ...@@ -1513,6 +1514,11 @@ int ChatMessage::putCharacter (uint32_t character) {
return 0; return 0;
} }
void ChatMessage::fileUploadEndBackgroundTask () {
L_D();
d->fileTransferChatMessageModifier.fileUploadEndBackgroundTask();
}
std::ostream& operator<<(std::ostream& lhs, ChatMessage::State e) { std::ostream& operator<<(std::ostream& lhs, ChatMessage::State e) {
switch(e) { switch(e) {
case ChatMessage::State::Idle: lhs << "Idle"; break; case ChatMessage::State::Idle: lhs << "Idle"; break;
......
...@@ -142,6 +142,7 @@ public: ...@@ -142,6 +142,7 @@ public:
bool downloadFile (FileTransferContent *content); bool downloadFile (FileTransferContent *content);
bool isFileTransferInProgress () const; bool isFileTransferInProgress () const;
void fileUploadEndBackgroundTask ();
protected: protected:
explicit ChatMessage (ChatMessagePrivate &p); explicit ChatMessage (ChatMessagePrivate &p);
......
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
void cancelFileTransfer (); void cancelFileTransfer ();
bool isFileTransferInProgressAndValid () const; bool isFileTransferInProgressAndValid () const;
std::string createFakeFileTransferFromUrl (const std::string &url); std::string createFakeFileTransferFromUrl (const std::string &url);
void fileUploadEndBackgroundTask ();
private: private:
// Body handler is optional, but if set this method takes owneship of it, even in error cases. // Body handler is optional, but if set this method takes owneship of it, even in error cases.
...@@ -71,7 +72,7 @@ private: ...@@ -71,7 +72,7 @@ private:
// Body handler is optional, but if set this method takes owneship of it, even in error cases. // 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); 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 fileUploadBeginBackgroundTask ();
void fileUploadEndBackgroundTask ();
void onDownloadFailed (); void onDownloadFailed ();
void releaseHttpRequest (); void releaseHttpRequest ();
......
...@@ -286,6 +286,11 @@ void CorePrivate::uninit() { ...@@ -286,6 +286,11 @@ void CorePrivate::uninit() {
} }
} }
#endif #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