[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5069 - GNUnet/src/applications/gap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5069 - GNUnet/src/applications/gap |
Date: |
Fri, 15 Jun 2007 18:05:52 -0600 (MDT) |
Author: grothoff
Date: 2007-06-15 18:05:52 -0600 (Fri, 15 Jun 2007)
New Revision: 5069
Modified:
GNUnet/src/applications/gap/gap.c
Log:
somehow seen made trouble for gaptest3, resolved by changing order
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2007-06-15 22:58:45 UTC (rev 5068)
+++ GNUnet/src/applications/gap/gap.c 2007-06-16 00:05:52 UTC (rev 5069)
@@ -1009,15 +1009,16 @@
ite->priority = priority;
}
} else { /* GROW mode */
- GE_ASSERT(ectx, equalsHashCode512(query,
- &ite->primaryKey));
- for (i=0;i<ite->hostsWaiting;i++)
- if (sender == ite->destination[i])
- return SYSERR; /* already there! */
+ GE_ASSERT(ectx,
+ equalsHashCode512(query,
+ &ite->primaryKey));
/* extend lifetime */
if (ite->ttl < now + ttl)
ite->ttl = now + ttl;
ite->priority += priority;
+ for (i=0;i<ite->hostsWaiting;i++)
+ if (sender == ite->destination[i])
+ return SYSERR; /* already there! */
}
if (stats != NULL)
stats->change(stat_memory_destinations, 1);
@@ -1638,7 +1639,7 @@
((char*)&enc2)[6] = '\0';
GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
- "GAP received content %s from `%s'\n",
+ "GAP received content `%s' from `%s'\n",
&enc2,
(host != NULL) ? (const char*)&enc : "myself");
#endif
@@ -1661,21 +1662,7 @@
rhf(value,
&contentHC);
- /* FIRST: check if seen */
- MUTEX_LOCK(lookup_exclusion);
- for (i=0;i<ite->seenIndex;i++) {
- if (equalsHashCode512(&contentHC,
- &ite->seen[i])) {
- MUTEX_UNLOCK(lookup_exclusion);
- FREE(value);
- if (stats != NULL)
- stats->change(stat_routing_reply_dups, 1);
- return 0; /* seen before, useless */
- }
- }
- MUTEX_UNLOCK(lookup_exclusion);
-
- /* SECOND: check if valid */
+ /* FIRST: check if valid */
ret = bs->put(bs->closure,
&msg->primaryKey,
value,
@@ -1697,6 +1684,21 @@
return SYSERR; /* invalid */
}
+ /* SECOND: check if seen */
+ MUTEX_LOCK(lookup_exclusion);
+ for (i=0;i<ite->seenIndex;i++) {
+ if (equalsHashCode512(&contentHC,
+ &ite->seen[i])) {
+ MUTEX_UNLOCK(lookup_exclusion);
+ FREE(value);
+ if (stats != NULL)
+ stats->change(stat_routing_reply_dups, 1);
+ return 0; /* seen before, useless */
+ }
+ }
+ MUTEX_UNLOCK(lookup_exclusion);
+
+
/* THIRD: compute content priority/value and
send remote reply (ITE processing) */
hostId = intern_pid(host);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5069 - GNUnet/src/applications/gap,
gnunet <=