From 285a6cc7385f8c946685b3f39164df6e179e4288 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 17 Sep 2015 14:51:48 -0700 Subject: [PATCH] use erase directly for cleanupConnection --- libraries/networking/src/udt/Socket.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index 3327ea9dc7..50f2e67007 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -207,14 +207,12 @@ void Socket::clearConnections() { } void Socket::cleanupConnection(HifiSockAddr sockAddr) { - auto it = _connectionsHash.find(sockAddr); + auto numErased = _connectionsHash.erase(sockAddr); - if (it != _connectionsHash.end()) { + if (numErased > 0) { #ifdef UDT_CONNECTION_DEBUG qCDebug(networking) << "Socket::cleanupConnection called for UDT connection to" << sockAddr; #endif - - _connectionsHash.erase(sockAddr); } }