Skip to content
Snippets Groups Projects
Commit 7b454ff6 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

MessageEngine: reset message status on content replace

Change-Id: I62720173f91c1e32be9428485449cbcc7b388c9a
parent 7463a8a2
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,7 @@ MessageEngine::sendMessage(const std::string& to,
token = refreshToken;
previousIt->second.to = to;
previousIt->second.payloads = payloads;
previousIt->second.status = MessageStatus::IDLE;
} else {
do {
token = std::uniform_int_distribution<MessageToken> {1, JAMI_ID_MAX_VAL}(
......@@ -95,6 +96,7 @@ MessageEngine::retrySend(const std::string& peer, bool retryOnTimeout, const std
std::map<std::string, std::string> payloads;
};
std::vector<PendingMsg> pending {};
auto now = clock::now();
{
std::lock_guard lock(messagesMutex_);
......@@ -109,7 +111,7 @@ MessageEngine::retrySend(const std::string& peer, bool retryOnTimeout, const std
|| m->second.status == MessageStatus::IDLE) {
m->second.status = MessageStatus::SENDING;
m->second.retried++;
m->second.last_op = clock::now();
m->second.last_op = now;
pending.emplace_back(PendingMsg {m->first, m->second.to, m->second.payloads});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment