gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (aa189e94b -> 984f1197d)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (aa189e94b -> 984f1197d)
Date: Sun, 22 Jan 2017 17:28:48 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from aa189e94b add sanity check for GNUNET_MQ_notify_sent
     new c2ed00daf logging fixes, notify MQM clients properly
     new 970d06eab pass correct closure
     new 984f1197d initialize new path fully before trying to attach it

The 3 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-new_channel.c    | 30 ++++-----
 src/cadet/gnunet-service-cadet-new_connection.c | 28 ++++----
 src/cadet/gnunet-service-cadet-new_paths.c      | 90 ++++++++++++++++---------
 src/cadet/gnunet-service-cadet-new_peer.c       |  2 +
 src/cadet/gnunet-service-cadet-new_tunnels.c    |  6 +-
 5 files changed, 93 insertions(+), 63 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet-new_channel.c 
b/src/cadet/gnunet-service-cadet-new_channel.c
index 563b1c7e7..c129022ca 100644
--- a/src/cadet/gnunet-service-cadet-new_channel.c
+++ b/src/cadet/gnunet-service-cadet-new_channel.c
@@ -325,7 +325,7 @@ GCCH_2s (const struct CadetChannel *ch)
 
   GNUNET_snprintf (buf,
                    sizeof (buf),
-                   "%s:%s ctn:%X(%X)",
+                   "Channel %s:%s ctn:%X(%X)",
                    GNUNET_i2s (GCP_get_id (GCT_get_destination (ch->t))),
                    GNUNET_h2s (&ch->port),
                    ch->ctn,
@@ -439,7 +439,7 @@ send_channel_open (void *cls)
 
   ch->retry_task = NULL;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending CHANNEL_OPEN message for channel %s\n",
+       "Sending CHANNEL_OPEN message for %s\n",
        GCCH_2s (ch));
   options = 0;
   if (ch->nobuffer)
@@ -702,7 +702,7 @@ GCCH_bind (struct CadetChannel *ch,
   uint32_t options;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Binding channel %s from tunnel %s to port %s of client %s\n",
+       "Binding %s from tunnel %s to port %s of client %s\n",
        GCCH_2s (ch),
        GCT_2s (ch->t),
        GNUNET_h2s (&ch->port),
@@ -829,7 +829,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch)
       return;
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received channel OPEN_ACK for waiting channel %s, entering READY 
state\n",
+         "Received channel OPEN_ACK for waiting %s, entering READY state\n",
          GCCH_2s (ch));
     GNUNET_SCHEDULER_cancel (ch->retry_task);
     ch->retry_task = NULL;
@@ -843,7 +843,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch)
   case CADET_CHANNEL_READY:
     /* duplicate ACK, maybe we retried the CREATE. Ignore. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received duplicate channel OPEN_ACK for channel %s\n",
+         "Received duplicate channel OPEN_ACK for %s\n",
          GCCH_2s (ch));
     GNUNET_STATISTICS_update (stats,
                               "# duplicate CREATE_ACKs",
@@ -906,7 +906,7 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch,
 
   payload_size = ntohs (msg->header.size) - sizeof (*msg);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receicved %u bytes of application data on channel %s\n",
+       "Receicved %u bytes of application data on %s\n",
        (unsigned int) payload_size,
        GCCH_2s (ch));
   env = GNUNET_MQ_msg_extra (ld,
@@ -1029,7 +1029,7 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch)
   struct GNUNET_CADET_LocalChannelDestroyMessage *tdm;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received remote channel DESTROY for channel %s\n",
+       "Received remote channel DESTROY for %s\n",
        GCCH_2s (ch));
   ch->destroy = GNUNET_YES;
   env = GNUNET_MQ_msg (tdm,
@@ -1092,7 +1092,7 @@ GCCH_check_allow_client (struct CadetChannel *ch)
   {
     /* destination did not yet ACK our CREATE! */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Channel %s not yet ready, throttling client until ACK.\n",
+         "%s not yet ready, throttling client until ACK.\n",
          GCCH_2s (ch));
     return;
   }
@@ -1100,7 +1100,7 @@ GCCH_check_allow_client (struct CadetChannel *ch)
   {
     /* Too many messages in queue. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Message queue still too long on channel %s, throttling client until 
ACK.\n",
+         "Message queue still too long on %s, throttling client until ACK.\n",
          GCCH_2s (ch));
     return;
   }
@@ -1108,7 +1108,7 @@ GCCH_check_allow_client (struct CadetChannel *ch)
        (64 <= ntohl (ch->mid_send.mid) - ntohl 
(ch->head_sent->data_message.mid.mid)) )
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Gap in ACKs too big on channel %s, throttling client until ACK.\n",
+         "Gap in ACKs too big on %s, throttling client until ACK.\n",
          GCCH_2s (ch));
     return;
   }
@@ -1116,7 +1116,7 @@ GCCH_check_allow_client (struct CadetChannel *ch)
 
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending local ack to channel %s client\n",
+       "Sending local ack to %s client\n",
        GCCH_2s (ch));
   env = GNUNET_MQ_msg (msg,
                        GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK);
@@ -1234,7 +1234,7 @@ GCCH_handle_local_data (struct CadetChannel *ch,
                                ch->tail_sent,
                                crm);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending %u bytes from local client to channel %s\n",
+       "Sending %u bytes from local client to %s\n",
        payload_size,
        GCCH_2s (ch));
   crm->qe = GCT_send (ch->t,
@@ -1266,7 +1266,7 @@ send_client_buffered_data (struct CadetChannel *ch)
     return; /* missing next one in-order */
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Passing payload message to client on channel %s\n",
+              "Passing payload message to client on %s\n",
               GCCH_2s (ch));
 
   /* all good, pass next message to client */
@@ -1289,7 +1289,7 @@ send_client_buffered_data (struct CadetChannel *ch)
        maximum of 64 bits, and 15 is getting too close for comfort.)
        So we should send one now. */
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sender on channel %s likely blocked on flow-control, sending 
ACK now.\n",
+                "Sender on %s likely blocked on flow-control, sending ACK 
now.\n",
                 GCCH_2s (ch));
     if (GNUNET_YES == ch->reliable)
       send_channel_data_ack (ch);
@@ -1345,7 +1345,7 @@ GCCH_debug (struct CadetChannel *ch,
     return;
   }
   LOG2 (level,
-        "CHN Channel %s:%X (%p)\n",
+        "CHN %s:%X (%p)\n",
         GCT_2s (ch->t),
         ch->ctn,
         ch);
diff --git a/src/cadet/gnunet-service-cadet-new_connection.c 
b/src/cadet/gnunet-service-cadet-new_connection.c
index 9b0a2f13b..01fb100c8 100644
--- a/src/cadet/gnunet-service-cadet-new_connection.c
+++ b/src/cadet/gnunet-service-cadet-new_connection.c
@@ -162,7 +162,7 @@ GCC_destroy (struct CadetConnection *cc)
   struct GNUNET_MQ_Envelope *env = NULL;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Destroying connection %s\n",
+       "Destroying %s\n",
        GCC_2s (cc));
   if (CADET_CONNECTION_SENDING_CREATE != cc->state)
   {
@@ -210,7 +210,7 @@ void
 GCC_handle_connection_create_ack (struct CadetConnection *cc)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received CREATE_ACK for connection %s in state %d (%s)\n",
+       "Received CREATE_ACK for %s in state %d (%s)\n",
        GCC_2s (cc),
        cc->state,
        (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy");
@@ -246,7 +246,7 @@ GCC_handle_kx (struct CadetConnection *cc,
     /* We didn't get the CREATE_ACK, but instead got payload. That's fine,
        clearly something is working, so pretend we got an ACK. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Faking connection ACK for connection %s due to KX\n",
+         "Faking connection ACK for %s due to KX\n",
          GCC_2s (cc));
     GCC_handle_connection_create_ack (cc);
   }
@@ -270,7 +270,7 @@ GCC_handle_encrypted (struct CadetConnection *cc,
     /* We didn't get the CREATE_ACK, but instead got payload. That's fine,
        clearly something is working, so pretend we got an ACK. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Faking connection ACK for connection %s due to ENCRYPTED payload\n",
+         "Faking connection ACK for %s due to ENCRYPTED payload\n",
          GCC_2s (cc));
     GCC_handle_connection_create_ack (cc);
   }
@@ -306,7 +306,7 @@ send_create (void *cls)
     pids[i + 1] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path,
                                                         i));
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending CONNECTION_CREATE message for connection %s\n",
+       "Sending CONNECTION_CREATE message for %s\n",
        GCC_2s (cc));
   cc->env = env;
   cc->mqm_ready = GNUNET_NO;
@@ -330,7 +330,7 @@ send_create_ack (void *cls)
 
   cc->task = NULL;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending CONNECTION_CREATE_ACK message for connection %s\n",
+       "Sending CONNECTION_CREATE_ACK message for %s\n",
        GCC_2s (cc));
   GNUNET_assert (GNUNET_YES == cc->mqm_ready);
   env = GNUNET_MQ_msg (ack_msg,
@@ -357,7 +357,7 @@ GCC_handle_duplicate_create (struct CadetConnection *cc)
   if (GNUNET_YES == cc->mqm_ready)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Got duplicate CREATE for connection %s, scheduling another ACK\n",
+         "Got duplicate CREATE for %s, scheduling another ACK\n",
          GCC_2s (cc));
     /* Tell tunnel that we are not ready for transmission anymore
        (until CREATE_ACK is done) */
@@ -375,7 +375,7 @@ GCC_handle_duplicate_create (struct CadetConnection *cc)
        can only be an ACK or payload, either of which would
        do. So actually no need to do anything. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Got duplicate CREATE for connection %s. MQ is busy, not queueing 
another ACK\n",
+         "Got duplicate CREATE for %s. MQ is busy, not queueing another ACK\n",
          GCC_2s (cc));
   }
 }
@@ -401,7 +401,7 @@ manage_first_hop_mq (void *cls,
   {
     /* Connection is down, for now... */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Core MQ for connection %s went down\n",
+         "Core MQ for %s went down\n",
          GCC_2s (cc));
     cc->mqm_ready = GNUNET_NO;
     cc->state = CADET_CONNECTION_NEW;
@@ -418,7 +418,7 @@ manage_first_hop_mq (void *cls,
 
   cc->mqm_ready = GNUNET_YES;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Core MQ for connection %s became available in state %d\n",
+       "Core MQ for %s became available in state %d\n",
        GCC_2s (cc),
        cc->state);
   switch (cc->state)
@@ -495,7 +495,7 @@ connection_create (struct CadetPeer *destination,
   cc->path = path;
   cc->off = off;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Creating connection %s using path %s\n",
+       "Creating %s using path %s\n",
        GCC_2s (cc),
        GCPP_2s (path));
   GCPP_add_connection (path,
@@ -646,14 +646,14 @@ GCC_2s (const struct CadetConnection *cc)
   {
     GNUNET_snprintf (buf,
                      sizeof (buf),
-                     "Connection(%s(Tunnel(%s)))",
+                     "Connection %s (%s)",
                      GNUNET_sh2s (&cc->cid.connection_of_tunnel),
                      GCT_2s (cc->ct->t));
     return buf;
   }
   GNUNET_snprintf (buf,
                    sizeof (buf),
-                   "Connection(%s(Tunnel(NULL)))",
+                   "Connection %s",
                    GNUNET_sh2s (&cc->cid.connection_of_tunnel));
   return buf;
 }
@@ -686,7 +686,7 @@ GCC_debug (struct CadetConnection *cc,
     return;
   }
   LOG2 (level,
-        "Connection %s to %s via path %s in state %d is %s\n",
+        "%s to %s via path %s in state %d is %s\n",
         GCC_2s (cc),
         GCP_2s (cc->destination),
         GCPP_2s (cc->path),
diff --git a/src/cadet/gnunet-service-cadet-new_paths.c 
b/src/cadet/gnunet-service-cadet-new_paths.c
index 39658d4e8..c9fdbcb3a 100644
--- a/src/cadet/gnunet-service-cadet-new_paths.c
+++ b/src/cadet/gnunet-service-cadet-new_paths.c
@@ -25,7 +25,6 @@
  *
  * TODO:
  * - path desirability score calculations are not done
- *   (and will be tricky to have during path changes)
  */
 #include "platform.h"
 #include "gnunet-service-cadet-new_connection.h"
@@ -359,11 +358,30 @@ extend_path (struct CadetPeerPath *path,
   struct GNUNET_CONTAINER_HeapNode *hn;
   int i;
 
+  /* Expand path */
+  GNUNET_array_grow (path->entries,
+                     path->entries_length,
+                     old_len + num_peers);
+  for (i=num_peers-1;i >= 0;i--)
+  {
+    struct CadetPeerPathEntry *entry = GNUNET_new (struct CadetPeerPathEntry);
+
+    path->entries[old_len + i] = entry;
+    entry->peer = peers[i];
+    entry->path = path;
+    GCP_path_entry_add (entry->peer,
+                        entry,
+                        old_len + i);
+  }
+
   /* If we extend an existing path, detach it from the
      old owner and re-attach to the new one */
   hn = NULL;
   for (i=num_peers-1;i>=0;i--)
   {
+    struct CadetPeerPathEntry *entry = path->entries[old_len + i];
+
+    path->entries_length = old_len + i + 1;
     /* FIXME: note that path->desirability is used, but not yet updated here! 
*/
     hn = GCP_attach_path (peers[i],
                           path,
@@ -371,27 +389,25 @@ extend_path (struct CadetPeerPath *path,
                           GNUNET_YES);
     if (NULL != hn)
       break;
+    GCP_path_entry_remove (entry->peer,
+                           entry,
+                           old_len + i);
+    GNUNET_free (entry);
+    path->entries[old_len + i] = NULL;
   }
   if (NULL == hn)
-    return; /* none of the peers is interested in this path */
+  {
+    /* none of the peers is interested in this path;
+       shrink path back */
+    GNUNET_array_grow (path->entries,
+                       path->entries_length,
+                       old_len);
+    return;
+  }
   GCP_detach_path (path->entries[old_len-1]->peer,
                    path,
                    path->hn);
   path->hn = hn;
-  GNUNET_array_grow (path->entries,
-                     path->entries_length,
-                     old_len + i);
-  for (;i >= 0;i--)
-  {
-    struct CadetPeerPathEntry *entry = GNUNET_new (struct CadetPeerPathEntry);
-
-    path->entries[old_len + i] = entry;
-    entry->peer = peers[i];
-    entry->path = path;
-    GCP_path_entry_add (entry->peer,
-                        entry,
-                        old_len + i);
-  }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Extended path %s\n",
        GCPP_2s (path));
@@ -471,11 +487,27 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity 
*get_path,
 
   /* No match at all, create completely new path */
   path = GNUNET_new (struct CadetPeerPath);
+  path->entries_length = get_path_length + put_path_length;
+  path->entries = GNUNET_new_array (path->entries_length,
+                                    struct CadetPeerPathEntry *);
+  for (i=path->entries_length-1;i>=0;i--)
+  {
+    struct CadetPeerPathEntry *entry = GNUNET_new (struct CadetPeerPathEntry);
+
+    path->entries[i] = entry;
+    entry->peer = cpath[i];
+    entry->path = path;
+    GCP_path_entry_add (entry->peer,
+                        entry,
+                        i);
+  }
 
-  /* First, try to attach it */
+  /* Finally, try to attach it */
   hn = NULL;
   for (i=get_path_length + put_path_length-1;i>=0;i--)
   {
+    struct CadetPeerPathEntry *entry = path->entries[i];
+
     path->entries_length = i + 1;
     /* FIXME: note that path->desirability is used, but not yet initialized 
here! */
     hn = GCP_attach_path (cpath[i],
@@ -484,30 +516,26 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity 
*get_path,
                           GNUNET_NO);
     if (NULL != hn)
       break;
+    GCP_path_entry_remove (entry->peer,
+                           entry,
+                           i);
+    GNUNET_free (entry);
+    path->entries[i] = NULL;
   }
   if (NULL == hn)
   {
     /* None of the peers on the path care about it. */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Path discovered from DHT is not interesting to us\n");
+    GNUNET_free (path->entries);
     GNUNET_free (path);
     return;
   }
   path->hn = hn;
-  path->entries_length = i + 1;
-  path->entries = GNUNET_new_array (path->entries_length,
-                                    struct CadetPeerPathEntry *);
-  for (;i>=0;i--)
-  {
-    struct CadetPeerPathEntry *entry = GNUNET_new (struct CadetPeerPathEntry);
-
-    path->entries[i] = entry;
-    entry->peer = cpath[i];
-    entry->path = path;
-    GCP_path_entry_add (entry->peer,
-                        entry,
-                        i);
-  }
+  /* Shrink path to actual useful length */
+  GNUNET_array_grow (path->entries,
+                     path->entries_length,
+                     i);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Created new path %s based on information from DHT\n",
        GCPP_2s (path));
diff --git a/src/cadet/gnunet-service-cadet-new_peer.c 
b/src/cadet/gnunet-service-cadet-new_peer.c
index 1505914a1..f824caee6 100644
--- a/src/cadet/gnunet-service-cadet-new_peer.c
+++ b/src/cadet/gnunet-service-cadet-new_peer.c
@@ -530,6 +530,8 @@ mqm_execute (struct GCP_MessageQueueManager *mqm)
                   mqm->env);
   mqm->env = NULL;
   cp->mqm_ready_counter--;
+  mqm->cb (mqm->cb_cls,
+           GNUNET_YES);
 }
 
 
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c 
b/src/cadet/gnunet-service-cadet-new_tunnels.c
index a1a7b80fd..58486dce5 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -406,10 +406,10 @@ GCT_2s (const struct CadetTunnel *t)
   static char buf[64];
 
   if (NULL == t)
-    return "T(NULL)";
+    return "Tunnel(NULL)";
   GNUNET_snprintf (buf,
                    sizeof (buf),
-                   "T(%s)",
+                   "Tunnel %s",
                    GNUNET_i2s (GCP_get_id (t->destination)));
   return buf;
 }
@@ -2235,7 +2235,7 @@ GCT_add_inbound_connection (struct CadetTunnel *t,
                                ct,
                                cid,
                                &connection_ready_cb,
-                               t);
+                               ct);
   /* FIXME: schedule job to kill connection (and path?)  if it takes
      too long to get ready! (And track performance data on how long
      other connections took with the tunnel!)

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



reply via email to

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