]> git.seodisparate.com - UDPConnection/commitdiff
Add |id| to PacketInfo
authorStephen Seo <seo.disparate@gmail.com>
Sun, 10 Jan 2021 05:40:17 +0000 (14:40 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Sun, 10 Jan 2021 05:40:17 +0000 (14:40 +0900)
.gitignore
src/UDPC.h
src/UDPConnection.cpp

index 1bdd080171891b5872e12eaeec9c0c203d6a00d4..6bfb72ba11ed04b926e823a90ec052f36bd5d920 100644 (file)
@@ -3,3 +3,4 @@ build*/
 compile_commands.json
 *.o
 doxygen_out/
+/tags
index 728d914ddd2d90695c3f77eb204184869058f739..c921c90e6df18eb40b2513cf40b3e6cd87a75e38 100644 (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.
index 85aa9a6fb4f8313b8f9aeea678990c01d4285a04..a00f1570b19cb42bc4bc618b9529cf18213123f9 100644 (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