[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7811 - GNUnet/src/applications/fs/gap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7811 - GNUnet/src/applications/fs/gap |
Date: |
Mon, 27 Oct 2008 23:45:36 -0600 (MDT) |
Author: grothoff
Date: 2008-10-27 23:45:35 -0600 (Mon, 27 Oct 2008)
New Revision: 7811
Modified:
GNUnet/src/applications/fs/gap/gap.c
Log:
fix
Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c 2008-10-26 18:06:23 UTC (rev
7810)
+++ GNUnet/src/applications/fs/gap/gap.c 2008-10-28 05:45:35 UTC (rev
7811)
@@ -389,9 +389,9 @@
rl->remaining_value = priority > 0 ? priority - 1 : 0;
rl->value_offered = original_priority;
rl->expiration = newTTL;
- rl->next = table[index];
rl->response_target = peer;
rl->policy = policy;
+ rl->next = table[index];
table[index] = rl;
if (stats != NULL)
stats->change (stat_gap_query_routed, 1);
@@ -456,79 +456,82 @@
rid = GNUNET_FS_PT_intern (sender);
index = get_table_index (primary_query);
rl = table[index];
- prev = NULL;
+ block_count = 0;
if (rid != 0)
- {
- blocked[0] = rid;
- block_count = 1;
- }
- else
- {
- block_count = 0;
- }
+ blocked[block_count++] = rid;
was_new = GNUNET_NO;
+ prev = NULL;
while (rl != NULL)
{
- if (GNUNET_OK == GNUNET_FS_SHARED_test_valid_new_response (rl,
+ if (GNUNET_OK != GNUNET_FS_SHARED_test_valid_new_response (rl,
primary_query,
size,
data, &hc))
- {
- was_new = GNUNET_YES;
- GNUNET_GE_ASSERT (NULL, rl->response_target != 0);
- GNUNET_FS_PT_resolve (rl->response_target, &target);
- GNUNET_GE_ASSERT (NULL, block_count <= MAX_ENTRIES_PER_SLOT);
- blocked[block_count++] = rl->response_target;
- GNUNET_FS_PT_change_rc (rl->response_target, 1);
-
- rl->value_offered = 0;
- if (stats != NULL)
- stats->change (stat_trust_earned, rl->value_offered);
- if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
- GNUNET_FS_SHARED_mark_response_seen (&hc, rl);
- GNUNET_FS_PLAN_success (rid, NULL, rl->response_target, rl);
- value += rl->value;
- rl_value = rl->value;
- rl->value = 0;
-
- if (rl->type == GNUNET_ECRS_BLOCKTYPE_DATA)
- {
- if (prev == NULL)
- table[index] = rl->next;
- else
- prev->next = rl->next;
- GNUNET_FS_SHARED_free_request_list (rl);
- if (prev == NULL)
- rl = table[index];
- else
- rl = prev->next;
- continue;
- }
-
- /* queue response (do this last since ciphertext_send may
- cause the core to detect that the connection died which
- may result in changes to the request list!) */
- msg = GNUNET_malloc (sizeof (P2P_gap_reply_MESSAGE) + size);
- msg->header.type = htons (GNUNET_P2P_PROTO_GAP_RESULT);
- msg->header.size = htons (sizeof (P2P_gap_reply_MESSAGE) + size);
- msg->reserved = 0;
- msg->expiration = GNUNET_htonll (expiration);
- memcpy (&msg[1], data, size);
- coreAPI->ciphertext_send (&target,
- &msg->header,
- GNUNET_GAP_BASE_REPLY_PRIORITY * (1 +
-
rl_value),
- GNUNET_GAP_MAX_GAP_DELAY);
- GNUNET_free (msg);
-
- /* since the linked list may have changed, start again
- from the beginning! */
- rl = table[index];
- continue;
- }
- prev = rl;
- rl = rl->next;
- }
+
+ {
+ prev = rl;
+ rl = rl->next;
+ continue;
+ }
+ was_new = GNUNET_YES;
+ GNUNET_GE_ASSERT (NULL, rl->response_target != 0);
+ GNUNET_FS_PT_resolve (rl->response_target, &target);
+ GNUNET_GE_ASSERT (NULL, block_count <= MAX_ENTRIES_PER_SLOT);
+ blocked[block_count++] = rl->response_target;
+ GNUNET_FS_PT_change_rc (rl->response_target, 1);
+
+ rl->value_offered = 0;
+ if (stats != NULL)
+ stats->change (stat_trust_earned, rl->value_offered);
+ if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
+ GNUNET_FS_SHARED_mark_response_seen (&hc, rl);
+ GNUNET_FS_PLAN_success (rid, NULL, rl->response_target, rl);
+ value += rl->value;
+ rl_value = rl->value;
+ rl->value = 0;
+
+ if (rl->type == GNUNET_ECRS_BLOCKTYPE_DATA)
+ {
+ if (prev == NULL)
+ table[index] = rl->next;
+ else
+ prev->next = rl->next;
+ GNUNET_FS_SHARED_free_request_list (rl);
+ if (prev == NULL)
+ rl = table[index];
+ else
+ rl = prev->next;
+ continue;
+ }
+
+ /* queue response (do this last since ciphertext_send may
+ cause the core to detect that the connection died which
+ may result in changes to the request list!) */
+ msg = GNUNET_malloc (sizeof (P2P_gap_reply_MESSAGE) + size);
+ msg->header.type = htons (GNUNET_P2P_PROTO_GAP_RESULT);
+ msg->header.size = htons (sizeof (P2P_gap_reply_MESSAGE) + size);
+ msg->reserved = 0;
+ msg->expiration = GNUNET_htonll (expiration);
+ memcpy (&msg[1], data, size);
+ coreAPI->ciphertext_send (&target,
+ &msg->header,
+ GNUNET_GAP_BASE_REPLY_PRIORITY * (1 +
+ rl_value),
+ GNUNET_GAP_MAX_GAP_DELAY);
+ GNUNET_free (msg);
+
+ /* since the linked list may have changed, start again
+ from the beginning! */
+ rl = table[index];
+ GNUNET_FS_PT_decrement_rcs (blocked, block_count);
+ block_count = 0;
+ if (rid != 0)
+ {
+ rid = GNUNET_FS_PT_intern (sender);
+ if (rid != 0)
+ blocked[block_count++] = rid;
+ }
+ }
if (was_new == GNUNET_YES)
GNUNET_FS_MIGRATION_inject (primary_query,
size, data, expiration, block_count, blocked);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7811 - GNUnet/src/applications/fs/gap,
gnunet <=