gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: sanity checks


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: sanity checks
Date: Wed, 27 Feb 2019 22:15:34 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new bcb5e8d91 sanity checks
bcb5e8d91 is described below

commit bcb5e8d91393d99ea26128f8d5e0261fe6adccc4
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Wed Feb 27 22:15:30 2019 +0100

    sanity checks
---
 src/cadet/gnunet-service-cadet_channel.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet_channel.c 
b/src/cadet/gnunet-service-cadet_channel.c
index cd5093c46..1746fc509 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -1410,7 +1410,8 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel 
*ch,
      * We always send if possible in this case.
      * It is guaranteed that the queued MID < received MID
      **/
-    if (GNUNET_YES == ccc->client_ready)
+    if ((NULL != ccc->head_recv) &&
+        (GNUNET_YES == ccc->client_ready))
     {
       next_msg = ccc->head_recv;
       LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1429,12 +1430,11 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel 
*ch,
                                    next_msg);
       ccc->num_recv--;
       /* Do not process duplicate MID */
-      if ((msg->mid.mid == next_msg->mid.mid) || /* Duplicate */
-          (ntohl (msg->mid.mid) < ntohl (ch->mid_recv.mid))) /* Old */
+      if (msg->mid.mid == next_msg->mid.mid) /* Duplicate */
       {
         /* Duplicate within the queue, drop */
         LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Message on %s (mid %u) dropped\n",
+             "Message on %s (mid %u) dropped, duplicate\n",
              GCCH_2s (ch),
              ntohl (msg->mid.mid));
         GNUNET_free (next_msg);
@@ -1444,6 +1444,17 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel 
*ch,
       GNUNET_free (next_msg);
     }
 
+    if (ntohl (msg->mid.mid) < ntohl (ch->mid_recv.mid)) /* Old */
+    {
+      /* Duplicate within the queue, drop */
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Message on %s (mid %u) dropped, old.\n",
+           GCCH_2s (ch),
+           ntohl (msg->mid.mid));
+      GNUNET_MQ_discard (env);
+      return;
+    }
+
     /* Channel is unreliable, so we do not ACK. But we also cannot
        allow buffering everything, so check if we have space... */
     if (ccc->num_recv >= ch->max_pending_messages)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]