gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (73b0f06dd -> 71c1409cf)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (73b0f06dd -> 71c1409cf)
Date: Mon, 09 Jan 2017 07:38:38 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from 73b0f06dd even more .gitignore updates
     new daf0c12b5 fix crashes caused by DLL removes preceeding DLL inserts
     new 2ed3dc28a fix more field initialziation order issues
     new 5608aa06f fix format string issue
     new 1f7e0c6ec DLL remove already done inside of call_peer_cont()
     new 71c1409cf properly handle case of should-drop by asynchronously 
running continuation

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/cadet/gnunet-service-cadet_channel.c    |  6 ++--
 src/cadet/gnunet-service-cadet_connection.c |  9 +++---
 src/cadet/gnunet-service-cadet_peer.c       | 46 ++++++++++++++++++++++++-----
 src/cadet/gnunet-service-cadet_tunnel.c     |  4 +--
 4 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet_channel.c 
b/src/cadet/gnunet-service-cadet_channel.c
index 22349aa80..11f23d38a 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -2393,7 +2393,8 @@ GCCH_send_prebuilt_message (const struct 
GNUNET_MessageHeader *message,
       struct GNUNET_CADET_DataACK *ack_msg;
       ack_msg = (struct GNUNET_CADET_DataACK *) message;
       data_id = ntohl (ack_msg->mid);
-      SPRINTF (info, "0x%010lX", ack_msg->futures);
+      SPRINTF (info, "0x%010lX",
+              (unsigned long int) ack_msg->futures);
       break;
     }
     case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
@@ -2495,17 +2496,18 @@ GCCH_send_prebuilt_message (const struct 
GNUNET_MessageHeader *message,
         }
       }
 
+      chq->rel->uniq = chq;
       chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES,
                                            &ch_message_sent, chq);
       if (NULL == chq->tq)
       {
         GNUNET_break (0);
+       chq->rel->uniq = NULL;
         GCT_debug (ch->t, GNUNET_ERROR_TYPE_ERROR);
         GNUNET_free (chq);
         chq = NULL;
         return;
       }
-      chq->rel->uniq = chq;
       break;
 
 
diff --git a/src/cadet/gnunet-service-cadet_connection.c 
b/src/cadet/gnunet-service-cadet_connection.c
index 1c500f716..fa2bb962b 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -685,7 +685,7 @@ conn_message_sent (void *cls,
     LOG (GNUNET_ERROR_TYPE_INFO,
          ">>> %s (%s %4u) on conn %s (%p) %s [%5u] in queue %s\n",
          GC_m2s (type), GC_m2s (payload_type), pid, GCC_2s (c), c,
-         GC_f2s(fwd), size,
+         GC_f2s (fwd), size,
          GNUNET_STRINGS_relative_time_to_string (wait, GNUNET_YES));
 
   /* If c is NULL, nothing to update. */
@@ -3264,7 +3264,10 @@ GCC_send_prebuilt_message (const struct 
GNUNET_MessageHeader *message,
   c->pending_messages++;
 
   q = GNUNET_new (struct CadetConnectionQueue);
+  q->cont = cont;
+  q->cont_cls = cont_cls;
   q->forced = force;
+  GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q);
   q->peer_q = GCP_send (get_hop (c, fwd), message,
                         payload_type, payload_id,
                         c, fwd,
@@ -3272,13 +3275,11 @@ GCC_send_prebuilt_message (const struct 
GNUNET_MessageHeader *message,
   if (NULL == q->peer_q)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c));
+    GNUNET_CONTAINER_DLL_remove (fc->q_head, fc->q_tail, q);
     GNUNET_free (q);
     GCC_check_connections ();
     return NULL;
   }
-  q->cont = cont;
-  q->cont_cls = cont_cls;
-  GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q);
   GCC_check_connections ();
   return q;
 }
diff --git a/src/cadet/gnunet-service-cadet_peer.c 
b/src/cadet/gnunet-service-cadet_peer.c
index c312d56bf..c3701a39e 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -73,6 +73,11 @@ struct CadetPeerQueue {
     void *cont_cls;
 
     /**
+     * Task to asynchronously run the drop continuation.
+     */
+    struct GNUNET_SCHEDULER_Task *drop_task;
+  
+    /**
      * Time when message was queued for sending.
      */
     struct GNUNET_TIME_Absolute queue_timestamp;
@@ -1106,6 +1111,7 @@ call_peer_cont (struct CadetPeerQueue *q, int sent)
                  q->c, q->c_fwd, sent,
                  q->type, q->payload_type, q->payload_id,
                  q->size, wait_time);
+       q->cont = NULL;
     }
     GNUNET_CONTAINER_DLL_remove (q->peer->q_head, q->peer->q_tail, q);
 }
@@ -1131,6 +1137,22 @@ mq_sent (void *cls)
 
 
 /**
+ * Finish the drop operation.
+ *
+ * @param cls queue entry to finish drop for
+ */
+static void
+drop_cb (void *cls)
+{
+  struct CadetPeerQueue *q = cls;
+  
+  GNUNET_MQ_discard (q->env);
+  call_peer_cont (q, GNUNET_YES);
+  GNUNET_free (q);
+}
+
+
+/**
  * @brief Send a message to another peer (using CORE).
  *
  * @param peer Peer towards which to queue the message.
@@ -1191,7 +1213,8 @@ GCP_send (struct CadetPeer *peer,
     q->payload_id = payload_id;
     q->c = c;
     q->c_fwd = fwd;
-    GNUNET_MQ_notify_sent (q->env, mq_sent, q);
+    GNUNET_MQ_notify_sent (q->env, &mq_sent, q);
+    GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q);
 
     if (GNUNET_YES == q->management_traffic)
     {
@@ -1204,16 +1227,14 @@ GCP_send (struct CadetPeer *peer,
             LOG (GNUNET_ERROR_TYPE_WARNING, "DD %s (%s %u) on conn %s %s\n",
                  GC_m2s (q->type), GC_m2s (q->payload_type),
                  q->payload_id, GCC_2s (c), GC_f2s (q->c_fwd));
-            GNUNET_MQ_discard (q->env);
-            call_peer_cont (q, GNUNET_YES);
-            GNUNET_free (q);
-            return NULL;
+           q->drop_task = GNUNET_SCHEDULER_add_now (&drop_cb,
+                                                    q);
+           return q;
         }
         GNUNET_MQ_send (peer->core_mq, q->env);
         peer->queue_n++;
     }
 
-    GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q);
     GCC_check_connections ();
     return q;
 }
@@ -1231,9 +1252,18 @@ GCP_send (struct CadetPeer *peer,
 void
 GCP_send_cancel (struct CadetPeerQueue *q)
 {
-    call_peer_cont (q, GNUNET_NO);
+  if (NULL != q->drop_task)
+  {
+    GNUNET_SCHEDULER_cancel (q->drop_task);
+    q->drop_task = NULL;
+    GNUNET_MQ_discard (q->env);
+  }
+  else
+  {
     GNUNET_MQ_send_cancel (q->env);
-    GNUNET_free (q);
+  }
+  call_peer_cont (q, GNUNET_NO);
+  GNUNET_free (q);
 }
 
 
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c 
b/src/cadet/gnunet-service-cadet_tunnel.c
index 5b07e42c0..6ddcf6598 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -1418,11 +1418,11 @@ send_prebuilt_message (const struct 
GNUNET_MessageHeader *message,
     tq = existing_q;
     tq->tqd = NULL;
   }
+  tq->cont = cont;
+  tq->cont_cls = cont_cls;
   tq->cq = GCC_send_prebuilt_message (msg, type, mid, c, fwd, force,
                                       &tun_message_sent, tq);
   GNUNET_assert (NULL != tq->cq);
-  tq->cont = cont;
-  tq->cont_cls = cont_cls;
 
   return tq;
 }

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



reply via email to

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