diff options
| author | Moritz Warning <moritzwarning@web.de> | 2015-06-20 16:32:48 +0200 |
|---|---|---|
| committer | Moritz Warning <moritzwarning@web.de> | 2015-06-20 16:34:19 +0200 |
| commit | 787608b5683eb5df2a8ca0d365438234b5497c60 (patch) | |
| tree | 4abfae78ccfdfca2b62e8584db03ca76d206ef78 /node/Node.hpp | |
| parent | 2b04ac5e9b8be8bd1cc1263755a55a579f28009e (diff) | |
| download | infinitytier-787608b5683eb5df2a8ca0d365438234b5497c60.tar.gz infinitytier-787608b5683eb5df2a8ca0d365438234b5497c60.zip | |
use _network function to reduce source code complexity
Diffstat (limited to 'node/Node.hpp')
| -rw-r--r-- | node/Node.hpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/node/Node.hpp b/node/Node.hpp index 6ef306eb..b0f4ab22 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -158,12 +158,7 @@ public: inline SharedPtr<Network> network(uint64_t nwid) const { Mutex::Lock _l(_networks_m); - std::vector< SharedPtr<Network> >::const_iterator iter = std::lower_bound(_networks.begin(), _networks.end(), nwid, NetworkComparator()); - if(iter != _networks.end() && (*iter)->id() == nwid) { - return *iter; - } else { - return SharedPtr<Network>(); - } + return _network(nwid); } inline std::vector< SharedPtr<Network> > allNetworks() const @@ -217,6 +212,16 @@ private: } }; + inline SharedPtr<Network> _network(uint64_t nwid) const + { + std::vector< SharedPtr<Network> >::const_iterator iter = std::lower_bound(_networks.begin(), _networks.end(), nwid, NetworkComparator()); + if(iter != _networks.end() && (*iter)->id() == nwid) { + return *iter; + } else { + return SharedPtr<Network>(); + } + } + RuntimeEnvironment _RR; RuntimeEnvironment *RR; |
