protected void GetFollowUp(AsDhtGetState adgs) {
foreach (DictionaryEntry de in adgs.results) {
if(de.Value == null || de.Key == null) {
continue;
}
Hashtable res = (Hashtable) de.Value;
if(res.Count < MAJORITY || res.Count == DEGREE) {
if(res.Count < MAJORITY) {
if(Dht.DhtLog.Enabled) {
ProtocolLog.Write(Dht.DhtLog, String.Format(
"Failed get count:total = {0}:{1}", res.Count, DEGREE));
}
}
res.Clear();
continue;
}
MemBlock value = (MemBlock) de.Key;
int ttl = (int) adgs.ttls[value] / res.Count;
if(Dht.DhtLog.Enabled) {
ProtocolLog.Write(Dht.DhtLog, String.Format(
"Doing follow up put count:total = {0}:{1}", res.Count, DEGREE));
}
for(int i = 0; i < DEGREE; i++) {
if(!res.Contains(i)) {
MemBlock key = adgs.brunet_address_for_key[i];
Channel queue = new Channel();
Address target = new AHAddress(key);
AHSender s = new AHGreedySender(Node, target);
try {
_rpc.Invoke(s, queue, "dht.Put", key, value, ttl, false);
}
catch(Exception) {}
}
}
res.Clear();
}
adgs.ttls.Clear();
adgs.results.Clear();
}