gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17614 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r17614 - gnunet/src/fs
Date: Wed, 19 Oct 2011 16:09:50 +0200

Author: grothoff
Date: 2011-10-19 16:09:50 +0200 (Wed, 19 Oct 2011)
New Revision: 17614

Modified:
   gnunet/src/fs/gnunet-service-fs.c
   gnunet/src/fs/gnunet-service-fs_cp.c
   gnunet/src/fs/gnunet-service-fs_lc.c
   gnunet/src/fs/gnunet-service-fs_pe.c
   gnunet/src/fs/gnunet-service-fs_pr.c
   gnunet/src/fs/gnunet-service-fs_pr.h
Log:
prevent loopback routing, add some statistics, faster re-transmit

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2011-10-19 14:08:55 UTC (rev 17613)
+++ gnunet/src/fs/gnunet-service-fs.c   2011-10-19 14:09:50 UTC (rev 17614)
@@ -258,6 +258,15 @@
 {
   struct GSF_PendingRequest *pr = cls;
 
+  if (GNUNET_YES !=
+      GSF_pending_request_test_target_ (pr,
+                                       peer))
+  {
+    GNUNET_STATISTICS_update (GSF_stats,
+                             gettext_noop ("# Loopback routes suppressed"), 1,
+                             GNUNET_NO);
+    return;
+  }
   GSF_plan_add_ (cp, pr);
 }
 
@@ -430,7 +439,12 @@
   if (GNUNET_YES !=
       GSF_pending_request_test_target_ (pr,
                                        &pid))
+  {
+    GNUNET_STATISTICS_update (GSF_stats,
+                             gettext_noop ("# Loopback routes suppressed"), 1,
+                             GNUNET_NO);
     return GNUNET_YES;
+  }
   GSF_plan_add_ (cp, pr);
   return GNUNET_YES;
 }

Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c        2011-10-19 14:08:55 UTC (rev 
17613)
+++ gnunet/src/fs/gnunet-service-fs_cp.c        2011-10-19 14:09:50 UTC (rev 
17614)
@@ -1322,7 +1322,9 @@
                                      0) ? (const char *) &opt[bits] : NULL,
                                     bfsize, ntohl (gm->filter_mutator),
                                     1 /* anonymity */ ,
-                                    (uint32_t) priority, ttl, spid, NULL, 0,   
 /* replies_seen */
+                                    (uint32_t) priority, ttl, spid,
+                                   GNUNET_PEER_intern (other),
+                                   NULL, 0,    /* replies_seen */
                                     &handle_p2p_reply, peerreq);
   GNUNET_assert (NULL != pr);
   peerreq->pr = pr;

Modified: gnunet/src/fs/gnunet-service-fs_lc.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_lc.c        2011-10-19 14:08:55 UTC (rev 
17613)
+++ gnunet/src/fs/gnunet-service-fs_lc.c        2011-10-19 14:09:50 UTC (rev 
17614)
@@ -375,7 +375,7 @@
                                         ntohl (sm->anonymity_level),
                                         0 /* priority */ ,
                                         0 /* ttl */ ,
-                                        0 /* sender PID */ ,
+                                        0 /* sender PID */ , 0 /* origin PID 
*/,
                                         (const GNUNET_HashCode *) &sm[1], sc,
                                         &client_response_handler, cr);
   return cr->pr;

Modified: gnunet/src/fs/gnunet-service-fs_pe.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pe.c        2011-10-19 14:08:55 UTC (rev 
17613)
+++ gnunet/src/fs/gnunet-service-fs_pe.c        2011-10-19 14:09:50 UTC (rev 
17614)
@@ -229,12 +229,25 @@
                          total_delay * 1000LL / plan_count, GNUNET_NO);
   prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
   // FIXME: calculate 'rp->priority'!
+#if 0
   if (rp->transmission_counter < 32)
     delay =
         GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
                                        1LL << rp->transmission_counter);
   else
     delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
+#else
+  if (rp->transmission_counter < 32)
+    delay =
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+                                       rp->transmission_counter);
+  else if (rp->transmission_counter < 32)
+    delay =
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+                                       32 + (1LL << rp->transmission_counter));
+  else
+    delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
+#endif
   rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay);
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -361,14 +374,6 @@
     GSF_peer_transmit_cancel_ (pp->pth);
     pp->pth = NULL;
   }
-  GNUNET_STATISTICS_set (GSF_stats,
-                        gettext_noop ("# query delay heap size"), 
-                        GNUNET_CONTAINER_heap_get_size (pp->delay_heap),
-                        GNUNET_NO);
-  GNUNET_STATISTICS_set (GSF_stats,
-                        gettext_noop ("# query priority heap size"), 
-                        GNUNET_CONTAINER_heap_get_size (pp->priority_heap),
-                        GNUNET_NO);
   /* move ready requests to priority queue */
   while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
          (GNUNET_TIME_absolute_get_remaining

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2011-10-19 14:08:55 UTC (rev 
17613)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2011-10-19 14:09:50 UTC (rev 
17614)
@@ -104,6 +104,12 @@
   GNUNET_PEER_Id sender_pid;
 
   /**
+   * Identity of the peer that we should never forward this query
+   * to since it originated this query (0 for none).
+   */
+  GNUNET_PEER_Id origin_pid;
+
+  /**
    * Time we started the last datastore lookup.
    */
   struct GNUNET_TIME_Absolute qe_start;
@@ -226,6 +232,7 @@
  * @param priority maximum outgoing cummulative request priority to use
  * @param ttl current time-to-live for the request
  * @param sender_pid peer ID to use for the sender when forwarding, 0 for none
+ * @param origin_pid peer ID of origin of query (do not loop back)
  * @param replies_seen hash codes of known local replies
  * @param replies_seen_count size of the 'replies_seen' array
  * @param rh handle to call when we get a reply
@@ -242,6 +249,7 @@
                              uint32_t mingle, uint32_t anonymity_level,
                              uint32_t priority, int32_t ttl,
                              GNUNET_PEER_Id sender_pid,
+                             GNUNET_PEER_Id origin_pid,
                              const GNUNET_HashCode * replies_seen,
                              unsigned int replies_seen_count,
                              GSF_PendingRequestReplyHandler rh, void *rh_cls)
@@ -278,6 +286,7 @@
   pr->public_data.type = type;
   pr->public_data.start_time = GNUNET_TIME_absolute_get ();
   pr->sender_pid = sender_pid;
+  pr->origin_pid = origin_pid;
   pr->rh = rh;
   pr->rh_cls = rh_cls;
   GNUNET_assert ((sender_pid != 0) || (0 == (options & GSF_PRO_FORWARD_ONLY)));
@@ -562,6 +571,8 @@
   }
   GNUNET_PEER_change_rc (pr->sender_pid, -1);
   pr->sender_pid = 0;
+  GNUNET_PEER_change_rc (pr->origin_pid, -1);
+  pr->origin_pid = 0;
   if (NULL != pr->hnode)
   {
     GNUNET_CONTAINER_heap_remove_node (pr->hnode);
@@ -1214,7 +1225,7 @@
                                   /* queue priority */ ,
                                   (0 !=
                                    (GSF_PRO_PRIORITY_UNLIMITED &
-                                    pr->public_data.options)) ? UINT_MAX : 1
+                                    pr->public_data.options)) ? UINT_MAX : 16
                                   /* max queue size */ ,
                                   GNUNET_TIME_UNIT_FOREVER_REL,
                                   &process_local_reply, pr);
@@ -1253,7 +1264,7 @@
                                   /* queue priority */ ,
                                   (0 !=
                                    (GSF_PRO_PRIORITY_UNLIMITED &
-                                    pr->public_data.options)) ? UINT_MAX : 1
+                                    pr->public_data.options)) ? UINT_MAX : 16
                                   /* max queue size */ ,
                                   GNUNET_TIME_UNIT_FOREVER_REL,
                                   &process_local_reply, pr);
@@ -1279,7 +1290,7 @@
   {
     GNUNET_STATISTICS_update (GSF_stats,
                               gettext_noop
-                              ("# Datastore lookups concluded (found ultimate 
result)"),
+                              ("# Datastore lookups concluded (found last 
result)"),
                               1, GNUNET_NO);
     goto check_error_and_continue;
   }
@@ -1312,7 +1323,7 @@
                                 /* queue priority */ ,
                                 (0 !=
                                  (GSF_PRO_PRIORITY_UNLIMITED & pr->
-                                  public_data.options)) ? UINT_MAX : 1
+                                  public_data.options)) ? UINT_MAX : 16
                                 /* max queue size */ ,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 &process_local_reply, pr);
@@ -1347,9 +1358,9 @@
 {
   struct GNUNET_PeerIdentity pi;
   
-  if (0 == pr->sender_pid)
+  if (0 == pr->origin_pid)
     return GNUNET_YES;
-  GNUNET_PEER_resolve (pr->sender_pid, &pi);
+  GNUNET_PEER_resolve (pr->origin_pid, &pi);
   return (0 == memcmp (&pi, target, sizeof (struct GNUNET_PeerIdentity))) ? 
GNUNET_NO :GNUNET_YES;
 }
 
@@ -1388,7 +1399,7 @@
                                 /* queue priority */ ,
                                 (0 !=
                                  (GSF_PRO_PRIORITY_UNLIMITED & pr->
-                                  public_data.options)) ? UINT_MAX : 1
+                                  public_data.options)) ? UINT_MAX : 16
                                 /* max queue size */ ,
                                 GNUNET_TIME_UNIT_FOREVER_REL,
                                 &process_local_reply, pr);

Modified: gnunet/src/fs/gnunet-service-fs_pr.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.h        2011-10-19 14:08:55 UTC (rev 
17613)
+++ gnunet/src/fs/gnunet-service-fs_pr.h        2011-10-19 14:09:50 UTC (rev 
17614)
@@ -195,6 +195,7 @@
  * @param ttl current time-to-live for the request
  * @param sender_pid peer ID to use for the sender when forwarding, 0 for none;
  *                   reference counter is taken over by this function
+ * @param origin_pid peer ID of origin of query (do not loop back)
  * @param replies_seen hash codes of known local replies
  * @param replies_seen_count size of the 'replies_seen' array
  * @param rh handle to call when we get a reply
@@ -211,6 +212,7 @@
                              uint32_t mingle, uint32_t anonymity_level,
                              uint32_t priority, int32_t ttl,
                              GNUNET_PEER_Id sender_pid,
+                             GNUNET_PEER_Id origin_pid,
                              const GNUNET_HashCode * replies_seen,
                              unsigned int replies_seen_count,
                              GSF_PendingRequestReplyHandler rh, void *rh_cls);




reply via email to

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