[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6970 - GNUnet/src/applications/fs/gap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6970 - GNUnet/src/applications/fs/gap |
Date: |
Sun, 1 Jun 2008 11:27:50 -0600 (MDT) |
Author: grothoff
Date: 2008-06-01 11:27:48 -0600 (Sun, 01 Jun 2008)
New Revision: 6970
Modified:
GNUnet/src/applications/fs/gap/gap.c
Log:
fixing Mantis 1344
Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c 2008-06-01 17:19:34 UTC (rev
6969)
+++ GNUnet/src/applications/fs/gap/gap.c 2008-06-01 17:27:48 UTC (rev
6970)
@@ -438,6 +438,7 @@
PID_INDEX blocked[MAX_ENTRIES_PER_SLOT + 1];
unsigned int block_count;
int was_new;
+ unsigned int rl_value;
value = 0;
GNUNET_mutex_lock (GNUNET_FS_lock);
@@ -468,30 +469,17 @@
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);
- /* queue response */
- 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);
+
+ rl->value_offered = 0;
if (stats != NULL)
- {
- stats->change (stat_trust_earned, rl->value_offered);
- rl->value_offered = 0;
- }
+ stats->change (stat_trust_earned, rl->value_offered);
if (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
GNUNET_FS_SHARED_mark_response_seen (rl, &hc);
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)
@@ -505,6 +493,27 @@
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 in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6970 - GNUnet/src/applications/fs/gap,
gnunet <=