don't insert same transit tunnel twice

This commit is contained in:
orignal 2015-02-10 09:39:49 -05:00
parent d01f3b094b
commit a3c1c314d0

View File

@ -317,7 +317,11 @@ namespace tunnel
void Tunnels::AddTransitTunnel (TransitTunnel * tunnel) void Tunnels::AddTransitTunnel (TransitTunnel * tunnel)
{ {
std::unique_lock<std::mutex> l(m_TransitTunnelsMutex); std::unique_lock<std::mutex> l(m_TransitTunnelsMutex);
m_TransitTunnels[tunnel->GetTunnelID ()] = tunnel; if (!m_TransitTunnels.insert (std::make_pair (tunnel->GetTunnelID (), tunnel)).second)
{
LogPrint (eLogError, "Transit tunnel ", tunnel->GetTunnelID (), " already exists");
delete tunnel;
}
} }
void Tunnels::Start () void Tunnels::Start ()