From 16f2352a454293aabf57931837aa77d852d1c66a Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Wed, 29 Apr 2015 21:02:34 -0700 Subject: [PATCH] Minor cleanup of routing code in HttpServer. --- lib/HttpServer/HttpHandlerFactory.cpp | 9 ++++----- lib/HttpServer/HttpHandlerFactory.h | 16 ++-------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/lib/HttpServer/HttpHandlerFactory.cpp b/lib/HttpServer/HttpHandlerFactory.cpp index 6ee1996e4d..40e0de5c2b 100644 --- a/lib/HttpServer/HttpHandlerFactory.cpp +++ b/lib/HttpServer/HttpHandlerFactory.cpp @@ -243,12 +243,11 @@ HttpHandler* HttpHandlerFactory::createHandler (HttpRequest* request) { return new MaintenanceHandler(request); } - map const& ii = _constructors; + unordered_map const& ii = _constructors; string path = request->requestPath(); - map::const_iterator i = ii.find(path); + auto i = ii.find(path); void* data = nullptr; - // no direct match, check prefix matches if (i == ii.end()) { LOG_TRACE("no direct handler found, trying prefixes"); @@ -335,8 +334,8 @@ HttpHandler* HttpHandlerFactory::createHandler (HttpRequest* request) { // look up data - map const& jj = _datas; - map::const_iterator j = jj.find(path); + unordered_map const& jj = _datas; + auto j = jj.find(path); if (j != jj.end()) { data = j->second; diff --git a/lib/HttpServer/HttpHandlerFactory.h b/lib/HttpServer/HttpHandlerFactory.h index 5976199a82..a22f9aeccc 100644 --- a/lib/HttpServer/HttpHandlerFactory.h +++ b/lib/HttpServer/HttpHandlerFactory.h @@ -249,29 +249,17 @@ namespace triagens { void* _setContextData; -//////////////////////////////////////////////////////////////////////////////// -/// @brief authentication lock for cache -//////////////////////////////////////////////////////////////////////////////// - - basics::ReadWriteLock _authLock; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief authentication cache -//////////////////////////////////////////////////////////////////////////////// - - std::map _authCache; - //////////////////////////////////////////////////////////////////////////////// /// @brief list of constructors //////////////////////////////////////////////////////////////////////////////// - std::map _constructors; + std::unordered_map _constructors; //////////////////////////////////////////////////////////////////////////////// /// @brief list of data pointers for constructors //////////////////////////////////////////////////////////////////////////////// - std::map _datas; + std::unordered_map _datas; //////////////////////////////////////////////////////////////////////////////// /// @brief list of prefix handlers