diff options
author | fronneburg <fronneburg@xevo.com> | 2018-03-16 17:24:52 -0700 |
---|---|---|
committer | fronneburg <fronneburg@xevo.com> | 2018-03-27 12:26:51 -0700 |
commit | f2c2844eed982badaf27ddcb8a7fb96d5ad2d60b (patch) | |
tree | a8ab6daa560b9d2e382e032c6ff029e8e373f48a /src | |
parent | 1c7144db07fd740d671d9a78f60fbf6a9dc530f9 (diff) | |
download | sdl_core-f2c2844eed982badaf27ddcb8a7fb96d5ad2d60b.tar.gz |
remove appropriate entry(s) from SessionConnectionMap in Connection destructor
Diffstat (limited to 'src')
-rw-r--r-- | src/components/connection_handler/src/connection.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index b3b9e7da66..e3a45ede78 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -97,7 +97,19 @@ Connection::~Connection() { heart_beat_monitor_thread_->join(); delete heartbeat_monitor_; threads::DeleteThread(heart_beat_monitor_thread_); + + // Before clearing out the session_map_, we must remove all sessions + // associated with this Connection from the SessionConnectionMap. + NonConstDataAccessor<SessionConnectionMap> session_connection_map_accessor = connection_handler_->session_connection_map(); + SessionConnectionMap& session_connection_map = session_connection_map_accessor.GetData(); sync_primitives::AutoLock lock(session_map_lock_); + SessionMap::iterator session_it = session_map_.begin(); + while (session_it != session_map_.end()) { + LOG4CXX_INFO(logger_, "Removed Session ID " << static_cast<int>(session_it->first) << " from Session/Connection Map in Connection Destructor"); + session_connection_map.erase(session_it->first); + session_it++; + } + session_map_.clear(); } |