gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7171 - GNUnet/src/applications/fs/gap


From: gnunet
Subject: [GNUnet-SVN] r7171 - GNUnet/src/applications/fs/gap
Date: Thu, 12 Jun 2008 20:34:41 -0600 (MDT)

Author: grothoff
Date: 2008-06-12 20:34:41 -0600 (Thu, 12 Jun 2008)
New Revision: 7171

Modified:
   GNUnet/src/applications/fs/gap/plan.c
   GNUnet/src/applications/fs/gap/querymanager.c
Log:
removing some unnecessary locking

Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c       2008-06-13 00:21:30 UTC (rev 
7170)
+++ GNUnet/src/applications/fs/gap/plan.c       2008-06-13 02:34:41 UTC (rev 
7171)
@@ -543,7 +543,6 @@
   double entropy;
   double prob;
 
-  GNUNET_mutex_lock (GNUNET_FS_lock);   /* needed? */
   info = clients;
   while ((info != NULL) && ((info->client != client) || (info->peer != peer)))
     info = info->next;
@@ -568,10 +567,7 @@
       rank = rank->next;
     }
   if (total_score == 0)
-    {
-      GNUNET_mutex_unlock (GNUNET_FS_lock);
-      return GNUNET_NO;         /* no peers available */
-    }
+    return GNUNET_NO;         /* no peers available */    
 
   entropy = 0;
   rank = rpc.rankings;
@@ -638,7 +634,6 @@
       GNUNET_FS_PT_change_rc (rank->peer, -1);
       GNUNET_free (rank);
     }
-  GNUNET_mutex_unlock (GNUNET_FS_lock);
   return target_count > 0 ? GNUNET_YES : GNUNET_NO;
 }
 
@@ -725,9 +720,12 @@
   unsigned int off;
   unsigned int ret;
 
+  /* no locking required: this method will be
+     called by the core only while the core
+     lock is held (which is the same as the
+     FS lock) */
   off = 0;
   peer = GNUNET_FS_PT_intern (receiver);
-  GNUNET_mutex_lock (GNUNET_FS_lock);
   pl = queries;
   while ((pl != NULL) && (pl->peer != peer))
     pl = pl->next;
@@ -773,7 +771,6 @@
           e = n;
         }
     }
-  GNUNET_mutex_unlock (GNUNET_FS_lock);
   GNUNET_FS_PT_change_rc (peer, -1);
   return off;
 }

Modified: GNUnet/src/applications/fs/gap/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.c       2008-06-13 00:21:30 UTC 
(rev 7170)
+++ GNUnet/src/applications/fs/gap/querymanager.c       2008-06-13 02:34:41 UTC 
(rev 7171)
@@ -209,13 +209,14 @@
   if ((GNUNET_YES == GNUNET_FS_PLAN_request (client, 0, request)) &&
       (stats != NULL))
     stats->change (stat_gap_client_query_injected, 1);
-  if (request->anonymityLevel == 0)
+  if (anonymityLevel == 0)
     {
       request->last_dht_get = GNUNET_get_time ();
       request->dht_back_off = GNUNET_GAP_MAX_DHT_DELAY;
-      GNUNET_FS_DHT_execute_query (request->type, &request->queries[0]);
     }
   GNUNET_mutex_unlock (GNUNET_FS_lock);
+  if (anonymityLevel == 0)
+    GNUNET_FS_DHT_execute_query (type, query);
 }
 
 /**





reply via email to

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