gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -sending messages working


From: gnunet
Subject: [gnunet] branch master updated: -sending messages working
Date: Wed, 24 Feb 2021 19:07:58 +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 46111957d -sending messages working
46111957d is described below

commit 46111957db87028c369ea4792b9c533a9dd09a33
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Wed Feb 24 19:06:37 2021 +0100

    -sending messages working
---
 src/transport/gnunet-service-tng.c           | 111 +++++++++++++++------------
 src/transport/transport-testing2.c           |   9 ++-
 src/transport/transport_api2_communication.c |   2 +-
 3 files changed, 73 insertions(+), 49 deletions(-)

diff --git a/src/transport/gnunet-service-tng.c 
b/src/transport/gnunet-service-tng.c
index 8357947dd..f57d08395 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -3551,6 +3551,8 @@ free_queue (struct Queue *queue)
   struct PendingAcknowledgement *pa;
   struct VirtualLink *vl;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Cleaning up queue %u\n", queue->qid);
   if (NULL != queue->transmit_task)
   {
     GNUNET_SCHEDULER_cancel (queue->transmit_task);
@@ -4161,7 +4163,7 @@ queue_send_msg (struct Queue *queue,
   struct GNUNET_TRANSPORT_SendMessageTo *smt;
   struct GNUNET_MQ_Envelope *env;
 
-  //queue->idle = GNUNET_NO;
+  // queue->idle = GNUNET_NO;
   GNUNET_log (
     GNUNET_ERROR_TYPE_DEBUG,
     "Queueing %u bytes of payload for transmission <%llu> on queue %llu to 
%s\n",
@@ -9592,57 +9594,71 @@ handle_add_queue_message (void *cls,
     GNUNET_SERVICE_client_drop (tc->client);
     return;
   }
-  neighbour = lookup_neighbour (&aqm->receiver);
-  if (NULL == neighbour)
+  /* This may simply be a queue update */
+  for (queue = tc->details.communicator.queue_head;
+       NULL != queue;
+       queue = queue->next_client)
   {
-    neighbour = GNUNET_new (struct Neighbour);
-    neighbour->pid = aqm->receiver;
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_put (
-                     neighbours,
-                     &neighbour->pid,
-                     neighbour,
-                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-    neighbour->get =
-      GNUNET_PEERSTORE_iterate (peerstore,
-                                "transport",
-                                &neighbour->pid,
-                                GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME,
-                                &neighbour_dv_monotime_cb,
-                                neighbour);
+    if (queue->qid != aqm->qid)
+      continue;
+    neighbour = queue->neighbour;
+    break;
+  }
+  if (NULL == queue)
+  {
+    neighbour = lookup_neighbour (&aqm->receiver);
+    if (NULL == neighbour)
+    {
+      neighbour = GNUNET_new (struct Neighbour);
+      neighbour->pid = aqm->receiver;
+      GNUNET_assert (GNUNET_OK ==
+                     GNUNET_CONTAINER_multipeermap_put (
+                       neighbours,
+                       &neighbour->pid,
+                       neighbour,
+                       GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+      neighbour->get =
+        GNUNET_PEERSTORE_iterate (peerstore,
+                                  "transport",
+                                  &neighbour->pid,
+                                  GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME,
+                                  &neighbour_dv_monotime_cb,
+                                  neighbour);
+    }
+    addr_len = ntohs (aqm->header.size) - sizeof(*aqm);
+    addr = (const char *) &aqm[1];
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "New queue %s to %s available with QID %llu\n",
+                addr,
+                GNUNET_i2s (&aqm->receiver),
+                (unsigned long long) aqm->qid);
+    queue = GNUNET_malloc (sizeof(struct Queue) + addr_len);
+    queue->tc = tc;
+    queue->address = (const char *) &queue[1];
+    queue->pd.aged_rtt = GNUNET_TIME_UNIT_FOREVER_REL;
+    queue->qid = aqm->qid;
+    queue->neighbour = neighbour;
+    memcpy (&queue[1], addr, addr_len);
+    /* notify monitors about new queue */
+    {
+      struct MonitorEvent me = { .rtt = queue->pd.aged_rtt, .cs = queue->cs };
+
+      notify_monitors (&neighbour->pid, queue->address, queue->nt, &me);
+    }
+    GNUNET_CONTAINER_MDLL_insert (neighbour,
+                                  neighbour->queue_head,
+                                  neighbour->queue_tail,
+                                  queue);
+    GNUNET_CONTAINER_MDLL_insert (client,
+                                  tc->details.communicator.queue_head,
+                                  tc->details.communicator.queue_tail,
+                                  queue);
+
   }
-  addr_len = ntohs (aqm->header.size) - sizeof(*aqm);
-  addr = (const char *) &aqm[1];
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "New queue %s to %s available with QID %llu\n",
-              addr,
-              GNUNET_i2s (&aqm->receiver),
-              (unsigned long long) aqm->qid);
-  queue = GNUNET_malloc (sizeof(struct Queue) + addr_len);
-  queue->tc = tc;
-  queue->address = (const char *) &queue[1];
-  queue->pd.aged_rtt = GNUNET_TIME_UNIT_FOREVER_REL;
-  queue->qid = aqm->qid;
   queue->mtu = ntohl (aqm->mtu);
   queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt);
   queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs);
-  queue->neighbour = neighbour;
   queue->idle = GNUNET_YES;
-  memcpy (&queue[1], addr, addr_len);
-  /* notify monitors about new queue */
-  {
-    struct MonitorEvent me = { .rtt = queue->pd.aged_rtt, .cs = queue->cs };
-
-    notify_monitors (&neighbour->pid, queue->address, queue->nt, &me);
-  }
-  GNUNET_CONTAINER_MDLL_insert (neighbour,
-                                neighbour->queue_head,
-                                neighbour->queue_tail,
-                                queue);
-  GNUNET_CONTAINER_MDLL_insert (client,
-                                tc->details.communicator.queue_head,
-                                tc->details.communicator.queue_tail,
-                                queue);
   /* check if valdiations are waiting for the queue */
   (void)
   GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
@@ -10043,7 +10059,8 @@ do_shutdown (void *cls)
 
   (void) cls;
 
-  GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_cb, NULL);
+  //GNUNET_CONTAINER_multipeermap_iterate (neighbours,
+  //&free_neighbour_cb, NULL);
   if (NULL != peerstore)
   {
     GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_NO);
diff --git a/src/transport/transport-testing2.c 
b/src/transport/transport-testing2.c
index ee0c4494e..d553a3961 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -337,6 +337,7 @@ hello_iter_cb (void *cb_cls,
   struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cb_cls;
   if ((NULL == record) && (NULL == emsg))
   {
+    p->pic = NULL;
     LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration End\n");
     return;
   }
@@ -347,6 +348,7 @@ hello_iter_cb (void *cb_cls,
   p->hello[p->hello_size-1] = '\0';
 
   GNUNET_PEERSTORE_iterate_cancel (p->pic);
+  p->pic = NULL;
   if (NULL != p->start_cb)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -658,7 +660,7 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
   }
   if (NULL != p->pic)
   {
-    GNUNET_PEERSTORE_iterate_cancel (p->pic);
+    //GNUNET_PEERSTORE_iterate_cancel (p->pic);
     p->pic = NULL;
   }
   if (NULL != p->th)
@@ -684,6 +686,11 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
     GNUNET_ATS_connectivity_done (p->ats);
     p->ats = NULL;
   }
+  if (NULL != p->ah)
+  {
+    GNUNET_TRANSPORT_application_done (p->ah);
+    p->ah = NULL;
+  }
   if (NULL != p->ph)
   {
     GNUNET_PEERSTORE_disconnect (p->ph, GNUNET_NO);
diff --git a/src/transport/transport_api2_communication.c 
b/src/transport/transport_api2_communication.c
index b048ad851..3d9da08e4 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -677,7 +677,7 @@ handle_send_msg (void *cls, const struct 
GNUNET_TRANSPORT_SendMessageTo *smt)
   struct GNUNET_TRANSPORT_QueueHandle *qh;
 
   for (qh = ch->queue_head; NULL != qh; qh = qh->next)
-    if ((qh->queue_id == smt->qid) &&
+    if ((qh->queue_id == ntohl (smt->qid)) &&
         (0 == memcmp (&qh->peer,
                       &smt->receiver,
                       sizeof(struct GNUNET_PeerIdentity))))

-- 
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]