gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: we do not really need that loop atm


From: gnunet
Subject: [gnunet] branch master updated: we do not really need that loop atm
Date: Wed, 25 Dec 2019 12:10:33 +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 0c6f1a6cd we do not really need that loop atm
0c6f1a6cd is described below

commit 0c6f1a6cda162ac20bdca31085fba2361cb04b42
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Wed Dec 25 20:07:07 2019 +0900

    we do not really need that loop atm
---
 src/transport/gnunet-communicator-unix.c | 66 ++++++++++++++------------------
 1 file changed, 29 insertions(+), 37 deletions(-)

diff --git a/src/transport/gnunet-communicator-unix.c 
b/src/transport/gnunet-communicator-unix.c
index 5d7949b97..7d7f18a9c 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -784,47 +784,39 @@ select_read_cb (void *cls)
   }
 
   {
-    uint16_t offset = 0;
     uint16_t tsize = msize - sizeof(struct UNIXMessage);
-    const char *msgbuf = (const char *) &msg[1];
 
-    while (offset + sizeof(struct GNUNET_MessageHeader) <= tsize)
+    const struct GNUNET_MessageHeader *currhdr;
+    struct GNUNET_MessageHeader al_hdr;
+
+    currhdr = (const struct GNUNET_MessageHeader *) &msg[1];
+    /* ensure aligned access */
+    memcpy (&al_hdr, currhdr, sizeof(al_hdr));
+    if ((tsize < sizeof(struct GNUNET_MessageHeader)) ||
+        (tsize != ntohs(al_hdr.size)))
     {
-      const struct GNUNET_MessageHeader *currhdr;
-      struct GNUNET_MessageHeader al_hdr;
-      uint16_t csize;
-
-      currhdr = (const struct GNUNET_MessageHeader *) &msgbuf[offset];
-      /* ensure aligned access */
-      memcpy (&al_hdr, currhdr, sizeof(al_hdr));
-      csize = ntohs (al_hdr.size);
-      if ((csize < sizeof(struct GNUNET_MessageHeader)) ||
-          (csize > tsize - offset))
-      {
-        GNUNET_break_op (0);
-        break;
-      }
-      ret = GNUNET_TRANSPORT_communicator_receive (ch,
-                                                   &msg->sender,
-                                                   currhdr,
-                                                   
GNUNET_TIME_UNIT_FOREVER_REL,
-                                                   &receive_complete_cb,
-                                                   NULL);
-      if (GNUNET_SYSERR == ret)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Transport not up!\n");
-        return;   /* transport not up */
-      }
-      if (GNUNET_NO == ret)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Error sending message to transport\n");
-        break;
-      }
-      delivering_messages++;
-      offset += csize;
+      GNUNET_break_op (0);
+      return;
+    }
+    ret = GNUNET_TRANSPORT_communicator_receive (ch,
+                                                 &msg->sender,
+                                                 currhdr,
+                                                 GNUNET_TIME_UNIT_FOREVER_REL,
+                                                 &receive_complete_cb,
+                                                 NULL);
+    if (GNUNET_SYSERR == ret)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Transport not up!\n");
+      return;   /* transport not up */
+    }
+    if (GNUNET_NO == ret)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Error sending message to transport\n");
+      return;
     }
+    delivering_messages++;
   }
   if (delivering_messages >= max_queue_length)
   {

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



reply via email to

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