Merge pull request #796 from majestrate/master

optimize
pull/799/head
Jeff 5 years ago committed by GitHub
commit eb3a4d0266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,12 +76,12 @@ namespace llarp
0}; 0};
htobe16buf(frag.data() + 2, idx); htobe16buf(frag.data() + 2, idx);
htobe64buf(frag.data() + 4, m_MsgID); htobe64buf(frag.data() + 4, m_MsgID);
if(idx + FragmentSize < m_Size) const size_t fragsz =
std::copy(m_Data.begin() + idx, m_Data.begin() + idx + FragmentSize, idx + FragmentSize < m_Size ? FragmentSize : m_Size - idx;
std::back_inserter(frag)); const auto sz = frag.size();
else frag.resize(sz + fragsz);
std::copy(m_Data.begin() + idx, m_Data.begin() + m_Size, std::copy(m_Data.begin() + idx, m_Data.begin() + idx + fragsz,
std::back_inserter(frag)); frag.begin() + sz);
const llarp_buffer_t pkt(frag); const llarp_buffer_t pkt(frag);
sendpkt(pkt); sendpkt(pkt);
} }

Loading…
Cancel
Save