gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34177 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r34177 - gnunet/src/dht
Date: Wed, 20 Aug 2014 08:37:41 +0200

Author: supriti
Date: 2014-08-20 08:37:41 +0200 (Wed, 20 Aug 2014)
New Revision: 34177

Modified:
   gnunet/src/dht/gnunet-service-xdht_neighbours.c
Log:
xvine:fixes


Modified: gnunet/src/dht/gnunet-service-xdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_neighbours.c     2014-08-19 20:32:27 UTC 
(rev 34176)
+++ gnunet/src/dht/gnunet-service-xdht_neighbours.c     2014-08-20 06:37:41 UTC 
(rev 34177)
@@ -3644,7 +3644,27 @@
   
   memcpy (&key_value, &(get->key), sizeof (uint64_t));
   key_value = GNUNET_ntohll (key_value);
-
+  
+  /* Check if you are already a part of get path. */
+  unsigned int i;
+  for (i = 0; i < get_length; i++)
+  {
+    if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &get_path[i]))
+    {
+      get_length = i;
+      break;
+    }
+  }
+  
+  /* Add yourself in the get path. */
+  struct GNUNET_PeerIdentity gp[get_length + 1];
+  memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
+  gp[get_length] = my_identity;
+  get_length = get_length + 1;
+  GDS_CLIENTS_process_get (get->options, get->block_type,get->hop_count,
+                           get->desired_replication_level, 
get->get_path_length,
+                           gp, &get->key);
+  
   /* I am not the final destination. I am part of trail to reach final dest. */
   if (0 != (GNUNET_CRYPTO_cmp_peer_identity (&best_known_dest, &my_identity)))
   {
@@ -3659,6 +3679,10 @@
                                 "GET request, packet dropped."),
                                 1, GNUNET_NO);
       GNUNET_break (0);
+      /* We are not able to proceed further*/
+      GDS_DATACACHE_handle_get (&(get->key),(get->block_type), NULL, 0, NULL, 
0,
+                                get_length, gp, &gp[get_length - 2], 
+                                &my_identity);
       return GNUNET_OK;
     }
   }
@@ -3672,27 +3696,7 @@
     best_known_dest = successor.best_known_destination;
     intermediate_trail_id = successor.trail_id;
   }
-  
-  /* Check if you are already a part of get path. */
-  unsigned int i;
-  for (i = 0; i < get_length; i++)
-  {
-    if (0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &get_path[i]))
-    {
-      get_length = i;
-      break;
-    }
-  }
-  
-  /* Add yourself in the get path. */
-  struct GNUNET_PeerIdentity gp[get_length + 1];
-  memcpy (gp, get_path, get_length * sizeof (struct GNUNET_PeerIdentity));
-  gp[get_length] = my_identity;
-  get_length = get_length + 1;
-  GDS_CLIENTS_process_get (get->options, get->block_type,get->hop_count,
-                           get->desired_replication_level, 
get->get_path_length,
-                           gp, &get->key);
-  
+   
   /* I am the final destination. */
   if (0 == GNUNET_CRYPTO_cmp_peer_identity(&my_identity, &best_known_dest))
   {
@@ -5095,14 +5099,14 @@
   }
 
   trail_rejection = (const struct PeerTrailRejectionMessage *) message;
-  trail_length = (msize - sizeof (struct PeerTrailRejectionMessage))/
-                  sizeof (struct GNUNET_PeerIdentity);
   if ((msize - sizeof (struct PeerTrailRejectionMessage)) %
       sizeof (struct GNUNET_PeerIdentity) != 0)
   {
     GNUNET_break_op (0);
     return GNUNET_OK;
   }
+  trail_length = (msize - sizeof (struct PeerTrailRejectionMessage))/
+                  sizeof (struct GNUNET_PeerIdentity);
   
   GNUNET_STATISTICS_update (GDS_stats,
                             gettext_noop
@@ -5118,9 +5122,13 @@
           GNUNET_ntohll (trail_rejection->ultimate_destination_finger_value);
 
   /* First set the congestion time of the friend that sent you this message. */
-  GNUNET_assert (NULL !=
-                 (target_friend =
-                  GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer)));
+  target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer);
+  if (NULL == target_friend)
+  {
+    DEBUG ("\nLINE = %d ,No friend found.",__LINE__);
+    GNUNET_break(0);
+    return GNUNET_OK;
+  }
   target_friend->congestion_timestamp =
           GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(),
                                     congestion_timeout);
@@ -5137,10 +5145,15 @@
       next_peer = source;
     else
       next_peer = trail_peer_list[trail_length-1];
-   
-    GNUNET_assert (NULL !=
-                  (target_friend =
-                   GNUNET_CONTAINER_multipeermap_get (friend_peermap, 
&next_peer)));
+
+    target_friend =
+                   GNUNET_CONTAINER_multipeermap_get (friend_peermap, 
&next_peer);
+    if (NULL == target_friend)
+    {
+      DEBUG ("\nLINE = %d ,No friend found.",__LINE__);
+      GNUNET_break(0);
+      return GNUNET_OK;
+    }
     GDS_NEIGHBOURS_send_trail_rejection (source,
                                          ultimate_destination_finger_value,
                                          my_identity, is_predecessor,
@@ -5160,11 +5173,15 @@
       next_peer = source;
     else
       next_peer = trail_peer_list[trail_length-1];
-
-    GNUNET_assert (NULL !=
-                  (target_friend =
-                   GNUNET_CONTAINER_multipeermap_get (friend_peermap, 
&next_peer)));
-
+    
+    target_friend =
+                   GNUNET_CONTAINER_multipeermap_get (friend_peermap, 
&next_peer);
+    if (NULL == target_friend)
+    {
+      DEBUG ("\nLINE = %d ,No friend found.",__LINE__);
+      GNUNET_break(0);
+      return GNUNET_OK;
+    }
     GDS_NEIGHBOURS_send_trail_setup_result (source,
                                             my_identity,
                                             target_friend, trail_length,
@@ -5180,10 +5197,15 @@
     memcpy (peer_list, trail_peer_list, trail_length * sizeof (struct 
GNUNET_PeerIdentity));
     peer_list[trail_length] = my_identity;
 
-    GNUNET_assert (NULL !=
-                  (target_friend =
+    target_friend =
                    GNUNET_CONTAINER_multipeermap_get (friend_peermap, 
-                                                      &successor.next_hop)));
+                                                      &successor.next_hop);
+    if (NULL == target_friend)
+    {
+      DEBUG ("\nLINE = %d ,No friend found.",__LINE__);
+      GNUNET_break(0);
+      return GNUNET_OK;
+    }
     GDS_NEIGHBOURS_send_trail_setup (source,
                                      ultimate_destination_finger_value,
                                      successor.best_known_destination,




reply via email to

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