diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-28 16:04:52 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-28 16:04:52 +0000 |
| commit | 72e475dfdeaa4a87dff0eef994e7814e94c40363 (patch) | |
| tree | 94a84e90c14876db223e4a733f651fe0b034f5e9 /src/DHTConnectionImpl.cc | |
| parent | c342bde9627b434effbc0cd10b817670d1da0923 (diff) | |
2010-03-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Avoid to calculate end() iterator in each loop. std::deque is
particularly slow. Make sure that recalculate end iterator if
element is erased during loop.
Diffstat (limited to 'src/DHTConnectionImpl.cc')
| -rw-r--r-- | src/DHTConnectionImpl.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/DHTConnectionImpl.cc b/src/DHTConnectionImpl.cc index 7dabdffc..2e27c79d 100644 --- a/src/DHTConnectionImpl.cc +++ b/src/DHTConnectionImpl.cc @@ -57,8 +57,8 @@ bool DHTConnectionImpl::bind(uint16_t& port, IntSequence& ports) std::random_shuffle(randPorts.begin(), randPorts.end(), *SimpleRandomizer::getInstance().get()); - for(std::vector<int32_t>::const_iterator portItr = randPorts.begin(); - portItr != randPorts.end(); ++portItr) { + for(std::vector<int32_t>::const_iterator portItr = randPorts.begin(), + eoi = randPorts.end(); portItr != eoi; ++portItr) { if(!(0 < (*portItr) && (*portItr) <= 65535)) { continue; } |
