Browse Source

explicit release

ENGINE-781 Release_2.1.0-RC22
Volker Birk 2 years ago
parent
commit
97a554f25e
2 changed files with 12 additions and 8 deletions
  1. +10
    -8
      message_cache.cc
  2. +2
    -0
      message_cache.hh

+ 10
- 8
message_cache.cc View File

@ -81,13 +81,20 @@ namespace pEp {
}
PEP_STATUS MessageCache::cache_release(const char *id)
{
message_cache.release(id);
return PEP_STATUS_OK;
}
void MessageCache::release(std::string id)
{
try {
std::lock_guard<std::mutex> l(message_cache._mtx);
message_cache._cache.erase(std::string(id));
::free_message(_cache.at(id).src);
::free_message(_cache.at(id).dst);
_cache.erase(id);
}
catch (...) { }
return PEP_STATUS_OK;
}
static char *dup(const char *src)
@ -348,12 +355,7 @@ namespace pEp {
has_pEp_msg_attachment);
::free_message(_msg);
{
std::lock_guard<std::mutex> l(_mtx);
::free_message(_cache.at(msg->id).src);
::free_message(_cache.at(msg->id).dst);
_cache.erase(msg->id);
}
cache_release(msg->id);
return status;
}


+ 2
- 0
message_cache.hh View File

@ -75,6 +75,8 @@ namespace pEp {
static PEP_STATUS cache_release(const char *id);
protected:
void release(std::string id);
PEP_STATUS mime_decode_message(
const char *mimetext,
size_t size,


Loading…
Cancel
Save