*/
#define DHT_SEND_VERIFY_SUCCESSOR_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
+/**
+ * How long to wait before sending another verify successor message.
+ */
+#define DHT_SEND_VERIFY_SUCCESSOR_RETRY_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
+
/**
* How long at most to wait for transmission of a request to a friend ?
*/
*/
static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_task;
+/**
+ * Task that sends verify successor message. This task is started when we get
+ * our successor for the first time.
+ */
+static GNUNET_SCHEDULER_TaskIdentifier send_verify_successor_retry_task;
+
/**
* Identity of this peer.
*/
*/
static struct GNUNET_TIME_Relative verify_successor_next_send_time;
+/**
+ * Time duration to send verify successor again, if result was not received in time.
+ */
+static struct GNUNET_TIME_Relative verify_successor_retry_time;
+
/**
* Are we waiting for confirmation from our new successor that it got the
* message
/* Send trail teardown message across the replaced trail. */
struct Trail *replace_trail = &finger->trail_list[largest_trail_index];
next_hop = GDS_ROUTING_get_next_hop (replace_trail->trail_id, GDS_ROUTING_SRC_TO_DEST);
- FPRINTF (stderr,_("\nSUPU %s, %s, %d, REMOVE trail id = %s"),__FILE__, __func__,__LINE__,GNUNET_h2s(&replace_trail->trail_id));
GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail (replace_trail->trail_id));
GDS_NEIGHBOURS_send_trail_teardown (replace_trail->trail_id,
GDS_ROUTING_SRC_TO_DEST,
struct FingerInfo *successor;
/* After one round of verify successor, we do back off. */
- send_verify_successor_task =
- GNUNET_SCHEDULER_add_delayed (verify_successor_next_send_time,
+ send_verify_successor_retry_task =
+ GNUNET_SCHEDULER_add_delayed (verify_successor_retry_time,
&send_verify_successor_message,
NULL);
successor = &finger_table[0];
/* Add yourself to the list. */
struct GNUNET_PeerIdentity pp[putlen + 1];
- if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
+ //if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
+ if (1)
{
memcpy (pp, put_path, putlen * sizeof (struct GNUNET_PeerIdentity));
pp[putlen] = my_identity;
// }
// else
// *next_hop = trail[my_index + 1];
+
+ return GNUNET_OK;
}
target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, next_hop);
const struct GNUNET_PeerIdentity *trail;
unsigned int trail_length;
size_t msize;
-
+
msize = ntohs (message->size);
if (msize < sizeof (struct PeerVerifySuccessorResultMessage))
{
/* As we completed one round of verify successor, we can do backoff. */
// verify_successor_next_send_time =
// GNUNET_TIME_STD_BACKOFF(verify_successor_next_send_time);
+
+ // Cancel Retry Task
+ GNUNET_SCHEDULER_cancel(send_verify_successor_retry_task);
+
compare_and_update_successor (current_successor,
probable_successor, trail, trail_length);
+
+ // Schedule send_verify_successor_task in appropriate time.
+ send_verify_successor_task = GNUNET_SCHEDULER_add_delayed(verify_successor_next_send_time,
+ send_verify_successor_message, NULL);
+
return GNUNET_OK;
}
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
DHT_SEND_VERIFY_SUCCESSOR_INTERVAL.rel_value_us);
+ verify_successor_retry_time.rel_value_us =
+ DHT_SEND_VERIFY_SUCCESSOR_RETRY_INTERVAL.rel_value_us +
+ GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
+ DHT_SEND_VERIFY_SUCCESSOR_RETRY_INTERVAL.rel_value_us);
+
return GNUNET_OK;
}