gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1000 - in GNUnet/src: applications/gap server


From: grothoff
Subject: [GNUnet-SVN] r1000 - in GNUnet/src: applications/gap server
Date: Sat, 25 Jun 2005 06:47:44 -0700 (PDT)

Author: grothoff
Date: 2005-06-25 06:47:40 -0700 (Sat, 25 Jun 2005)
New Revision: 1000

Modified:
   GNUnet/src/applications/gap/gap.c
   GNUnet/src/server/startup.c
Log:
bugfixes

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2005-06-25 13:45:47 UTC (rev 999)
+++ GNUnet/src/applications/gap/gap.c   2005-06-25 13:47:40 UTC (rev 1000)
@@ -150,7 +150,7 @@
  * THE VALUE YOU PICK MUST BE A POWER OF 2, for example:
  * 128, 256, 512, 1024, 2048, 4092, 8192, 16384, 32768, 65536
  */
-#define MIN_INDIRECTION_TABLE_SIZE (8192)
+#define MIN_INDIRECTION_TABLE_SIZE 1024
 /* #define MIN_INDIRECTION_TABLE_SIZE 8 */
 
 /**
@@ -360,15 +360,16 @@
    */
   int successful_local_lookup_in_delay_loop;
 
-  /**
-   * Avoiding concurrent lookups for the same ITE: lock to grant
-   * access to peers to perform a lookup that matches this ITE entry.
-   */
-   Mutex lookup_exclusion;
-
 } IndirectionTableEntry;
 
 /**
+ * Avoiding concurrent lookups for the same ITE: lock to grant
+ * access to peers to perform a lookup that matches this ITE entry.
+ */
+static Mutex lookup_exclusion;
+
+
+/**
  * @brief structure to keep track of which peers send responses
  *  to queries from a certain peer at the moment
  * Linked list of peer ids with number of replies received.
@@ -1546,7 +1547,7 @@
   EncName enc;
 
   ite = &ROUTING_indTable_[computeRoutingIndex(&query->queries[0])];
-  MUTEX_LOCK(&ite->lookup_exclusion);
+  MUTEX_LOCK(&lookup_exclusion);
   if (sender != NULL) {
     if ((policy & QUERY_INDIRECT) > 0) {
       needsForwarding(&query->queries[0],
@@ -1639,7 +1640,7 @@
 
 
 
-  MUTEX_UNLOCK(&ite->lookup_exclusion);
+  MUTEX_UNLOCK(&lookup_exclusion);
   if (doForward)
     forwardQuery(query,
                 sender);
@@ -1700,16 +1701,16 @@
       &contentHC);
   
   /* FIRST: check if seen */
-  MUTEX_LOCK(&ite->lookup_exclusion);
+  MUTEX_LOCK(&lookup_exclusion);
   for (i=0;i<ite->seenIndex;i++) {
     if (equalsHashCode512(&contentHC,
                          &ite->seen[i])) {
-      MUTEX_UNLOCK(&ite->lookup_exclusion);
+      MUTEX_UNLOCK(&lookup_exclusion);
       FREE(value);
       return 0; /* seen before, useless */
     }
   }
-  MUTEX_UNLOCK(&ite->lookup_exclusion);
+  MUTEX_UNLOCK(&lookup_exclusion);
 
   /* SECOND: check if valid */
   ret = bs->put(bs->closure,
@@ -1727,7 +1728,7 @@
 
   /* THIRD: compute content priority/value and
      send remote reply (ITE processing) */
-  MUTEX_LOCK(&ite->lookup_exclusion);
+  MUTEX_LOCK(&lookup_exclusion);
   if (equalsHashCode512(&ite->primaryKey,
                        &msg->primaryKey) ) {   
     prio = ite->priority;
@@ -1760,7 +1761,7 @@
     sendReply(ite,
              &msg->header);
   }
-  MUTEX_UNLOCK(&ite->lookup_exclusion);
+  MUTEX_UNLOCK(&lookup_exclusion);
   prio += claimReward(&msg->primaryKey, hostId);
 
   /* FOURTH: update content priority in local datastore */
@@ -2107,6 +2108,7 @@
                        "TABLESIZE");
   if (indirectionTableSize < MIN_INDIRECTION_TABLE_SIZE)
     indirectionTableSize = MIN_INDIRECTION_TABLE_SIZE;
+  MUTEX_CREATE(&lookup_exclusion);
   ROUTING_indTable_
     = MALLOC(sizeof(IndirectionTableEntry)
             * indirectionTableSize);
@@ -2116,7 +2118,6 @@
         * indirectionTableSize);       
   for (i=0;i<indirectionTableSize;i++) {
     ROUTING_indTable_[i].successful_local_lookup_in_delay_loop = NO;
-    MUTEX_CREATE(&ROUTING_indTable_[i].lookup_exclusion);
   }
 
   for (i=0;i<QUERY_RECORD_COUNT;i++) {
@@ -2166,7 +2167,6 @@
             NULL);
 
   for (i=0;i<indirectionTableSize;i++) {
-    MUTEX_DESTROY(&ROUTING_indTable_[i].lookup_exclusion);
     GROW(ROUTING_indTable_[i].seen,
         ROUTING_indTable_[i].seenIndex,
         0);
@@ -2176,6 +2176,7 @@
         0);
   }
 
+  MUTEX_DESTROY(&lookup_exclusion);
   while (rtdList != NULL) {
     pos = rtdList;
     rtdList = rtdList->next;

Modified: GNUnet/src/server/startup.c
===================================================================
--- GNUnet/src/server/startup.c 2005-06-25 13:45:47 UTC (rev 999)
+++ GNUnet/src/server/startup.c 2005-06-25 13:47:40 UTC (rev 1000)
@@ -221,7 +221,7 @@
   /* mechanism to stop gnunetd after a certain
      time without a signal -- to debug with valgrind*/
   valgrind = getConfigurationInt("GNUNETD",
-                "VALGRIND");
+                                "VALGRIND");
   if (valgrind > 0)
     addCronJob(&semaphore_up,
               valgrind * cronSECONDS,





reply via email to

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