gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: tng: UNIX communicator fixes. Test fixes


From: gnunet
Subject: [gnunet] branch master updated: tng: UNIX communicator fixes. Test fixes
Date: Mon, 01 Jun 2020 18:23:18 +0200

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 d20be8a91 tng: UNIX communicator fixes. Test fixes
d20be8a91 is described below

commit d20be8a919b93cbfd1e1de3b41ca0fa370949b05
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Mon Jun 1 18:18:00 2020 +0200

    tng: UNIX communicator fixes. Test fixes
---
 src/transport/gnunet-communicator-unix.c |  2 +-
 src/transport/test_communicator_basic.c  | 15 +++++++++++----
 src/transport/transport-testing2.c       |  4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/transport/gnunet-communicator-unix.c 
b/src/transport/gnunet-communicator-unix.c
index 27dda7281..148f7f886 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -669,7 +669,7 @@ setup_queue (const struct GNUNET_PeerIdentity *target,
     queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch,
                                                       &queue->target,
                                                       foreign_addr,
-                                                      UNIX_MTU,
+                                                      UNIX_MTU - sizeof 
(struct UNIXMessage),
                                                       
GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED,
                                                       0,
                                                       GNUNET_NT_LOOPBACK,
diff --git a/src/transport/test_communicator_basic.c 
b/src/transport/test_communicator_basic.c
index 1ea79fa19..26a10fb74 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -200,6 +200,8 @@ make_payload (size_t payload_size)
   struct GNUNET_TIME_AbsoluteNBO ts_n;
   char *payload = GNUNET_malloc (payload_size);
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Making payload of size %lu\n", payload_size);
   GNUNET_assert (payload_size >= 8); // So that out timestamp fits
   ts = GNUNET_TIME_absolute_get ();
   ts_n = GNUNET_TIME_absolute_hton (ts);
@@ -238,10 +240,10 @@ size_test (void *cls)
   GNUNET_assert (TP_SIZE_CHECK == phase);
   if (LONG_MESSAGE_SIZE != long_message_size)
     max_size = long_message_size;
-  if (ack >= max_size)
+  if (ack + 10 > max_size)
     return; /* Leave some room for our protocol, so not 2^16 exactly */
+  ack += 10;
   payload = make_payload (ack);
-  ack += 5;
   num_sent++;
   GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
                                                         (ack < max_size)
@@ -470,7 +472,7 @@ incoming_message_cb (void *cls,
                     goodput,
                     (unsigned long long) avg_latency);
         GNUNET_free (goodput);
-        ack = 10;
+        ack = 0;
         phase = TP_SIZE_CHECK;
         num_received = 0;
         num_sent = 0;
@@ -481,9 +483,14 @@ incoming_message_cb (void *cls,
     }
   case TP_SIZE_CHECK:
     {
+      size_t max_size = 64000;
+
+      GNUNET_assert (TP_SIZE_CHECK == phase);
+      if (LONG_MESSAGE_SIZE != long_message_size)
+        max_size = long_message_size;
       num_received++;
       update_avg_latency (payload);
-      if (num_received >= (64000 - 10) / 5)
+      if (num_received >= (max_size) / 10)
       {
         GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
                     "Size packet test done.\n");
diff --git a/src/transport/transport-testing2.c 
b/src/transport/transport-testing2.c
index 8250027f7..e85e46b11 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -525,6 +525,7 @@ handle_incoming_msg (void *cls,
     struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
 
     env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK);
+    GNUNET_assert (NULL != env);
     ack->reserved = htonl (0);
     ack->fc_id = inc_msg->fc_id;
     ack->sender = inc_msg->sender;
@@ -770,6 +771,8 @@ disconnect_cb (void *cls,
     GNUNET_CONTAINER_DLL_remove (tc_h->client_head,
                                  tc_h->client_tail,
                                  cl);
+    if (cl->c_mq == tc_h->c_mq)
+      tc_h->c_mq = NULL;
     GNUNET_free (cl);
     break;
   }
@@ -1164,6 +1167,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
   env = GNUNET_MQ_msg_extra (msg,
                              inbox_size,
                              GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG);
+  GNUNET_assert (NULL != env);
   msg->qid = htonl (tc_queue->qid);
   msg->mid = tc_queue->mid++;
   msg->receiver = tc_queue->peer_id;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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