From 4d95b9eb68c438ad166d75b1cb9053c03bf2356e Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 14 Mar 2008 13:38:51 +0000 Subject: bugfixes @ anyrtpproxy --- rtpSessionTable.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'rtpSessionTable.cpp') diff --git a/rtpSessionTable.cpp b/rtpSessionTable.cpp index a577613..1556752 100644 --- a/rtpSessionTable.cpp +++ b/rtpSessionTable.cpp @@ -18,8 +18,7 @@ * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -80,12 +79,20 @@ void RtpSessionTable::delSession(const std::string & call_id ) map_.erase(it); } -RtpSession& RtpSessionTable::getOrNewSessionUnlocked(const std::string & call_id) +RtpSession& RtpSessionTable::getOrNewSession(const std::string & call_id, bool& is_new) { + Lock lock(mutex_); + return getOrNewSessionUnlocked(call_id, is_new); +} + +RtpSession& RtpSessionTable::getOrNewSessionUnlocked(const std::string & call_id, bool& is_new) +{ + is_new = false; RtpSessionMap::iterator it = map_.find(call_id); if(it!=map_.end()) return *(it->second); + is_new = true; map_.insert(RtpSessionMap::value_type(call_id, new RtpSession())); it = map_.find(call_id); return *(it->second); -- cgit v1.2.3