Add |id| to PacketInfo

This commit is contained in:
Stephen Seo 2021-01-10 14:40:17 +09:00
parent ba3d6df406
commit e08e620b26
3 changed files with 12 additions and 0 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ build*/
compile_commands.json
*.o
doxygen_out/
/tags

View file

@ -182,6 +182,14 @@ typedef struct UDPC_EXPORT UDPC_PacketInfo {
* - 0x8: Is a packet that was re-sent
*/
uint32_t flags;
/*!
* \brief The packet's id.
*
* Packets start with id = 0, and will wrap around.
* This can be used to determine specifically how out of order a packet may
* be.
*/
uint32_t id;
/*!
* \brief The size in bytes of the received packet's data inside the \ref data
* pointer member variable.

View file

@ -1719,6 +1719,7 @@ void UDPC::Context::update_impl() {
recPktInfo.sender.port = ntohs(receivedData.sin6_port);
recPktInfo.receiver.port = ntohs(socketInfo.sin6_port);
recPktInfo.rtt = durationToMS(iter->second.rtt);
recPktInfo.id = seqID;
std::lock_guard<std::mutex> receivedPktsLock(receivedPktsMutex);
receivedPkts.push_back(recPktInfo);
@ -1739,6 +1740,7 @@ void UDPC::Context::update_impl() {
recPktInfo.sender.port = ntohs(receivedData.sin6_port);
recPktInfo.receiver.port = ntohs(socketInfo.sin6_port);
recPktInfo.rtt = durationToMS(iter->second.rtt);
recPktInfo.id = seqID;
std::lock_guard<std::mutex> receivedPktsLock(receivedPktsMutex);
receivedPkts.push_back(recPktInfo);
@ -1858,6 +1860,7 @@ UDPC_PacketInfo UDPC::get_empty_pinfo() {
return UDPC_PacketInfo {
0, // data (ptr)
0, // flags
0, // id
0, // dataSize
0, // rtt
{ // sender