From 9204582c0e6a77fcff97b1eb923e908280248eec Mon Sep 17 00:00:00 2001 From: Hanjie Wu Date: Sat, 16 Dec 2023 05:17:12 -0800 Subject: fix --- src/UTPexExtensionMessage.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/UTPexExtensionMessage.cc b/src/UTPexExtensionMessage.cc index ab6a4258..b825b4e5 100644 --- a/src/UTPexExtensionMessage.cc +++ b/src/UTPexExtensionMessage.cc @@ -105,15 +105,15 @@ UTPexExtensionMessage::createCompactPeerListAndFlag( std::string flagstring; std::string addrstring6; std::string flagstring6; - std::for_each(std::begin(peers), std::end(peers), [&](auto& peer) { + for (auto itr = std::begin(peers), eoi = std::end(peers); itr != eoi; ++itr) { unsigned char compact[COMPACT_LEN_IPV6]; - int compactlen = - bittorrent::packcompact(compact, peer->getIPAddress(), peer->getPort()); + int compactlen = bittorrent::packcompact(compact, (*itr)->getIPAddress(), + (*itr)->getPort()); char flags = 0x00; - if (peer->isSeeder()) { + if ((*itr)->isSeeder()) { flags |= PEX_FLAG_SEEDER; } - if (peer->uTPSupport()) { + if ((*itr)->uTPSupport()) { flags |= PEX_FLAG_UTP; } if (compactlen == COMPACT_LEN_IPV4) { @@ -124,7 +124,7 @@ UTPexExtensionMessage::createCompactPeerListAndFlag( addrstring6.append(&compact[0], &compact[compactlen]); flagstring6 += flags; } - }); + } return std::make_pair( std::make_pair(std::move(addrstring), std::move(flagstring)), std::make_pair(std::move(addrstring6), std::move(flagstring6))); -- cgit