IceTransport: cleanup
Change-Id: I5a8680332710a302fcbea03d2f6bb60a74e9ed61
diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index f2ab70b..b0d7a2e 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -172,13 +172,7 @@
std::atomic_bool is_stopped_ {false};
- struct Packet
- {
- Packet(void* pkt, pj_size_t size)
- : data {reinterpret_cast<char*>(pkt), reinterpret_cast<char*>(pkt) + size}
- {}
- std::vector<char> data {};
- };
+ using Packet = std::vector<uint8_t>;
struct ComponentIO
{
@@ -1627,12 +1621,12 @@
}
auto& packet = io.queue.front();
- const auto count = std::min(len, packet.data.size());
- std::copy_n(packet.data.begin(), count, buf);
- if (count == packet.data.size()) {
+ const auto count = std::min(len, packet.size());
+ std::copy_n(packet.begin(), count, buf);
+ if (count == packet.size()) {
io.queue.pop_front();
} else {
- packet.data.erase(packet.data.begin(), packet.data.begin() + count);
+ packet.erase(packet.begin(), packet.begin() + count);
}
ec.clear();
@@ -1658,7 +1652,7 @@
if (io.recvCb) {
// Flush existing queue using the callback
for (const auto& packet : io.queue)
- io.recvCb((uint8_t*) packet.data.data(), packet.data.size());
+ io.recvCb((uint8_t*) packet.data(), packet.size());
io.queue.clear();
}
}