40 timeout = getParentModule()->getSubmodule(
"gia")->par(
"neighborTimeout");
47 error(
"this module doesn't handle messages, it runs only in initialize()");
60 if(it->first.getKey() == key)
85 neighbors.insert(std::make_pair(node, info));
108 for(
unsigned int j = 0; j < i; j++)
111 if (it !=
neighbors.end())
return it->first;
122 return &(it->second);
131 if(it->first.getKey() == key)
144 it->second.timestamp = simTime();
152 if(simTime() > (it->second.timestamp +
timeout)) {
169 it->second.keyList = keyList;
177 return &(it->second.keyList);
186 return it->first.getCapacity();
203 return it->second.connectionDegree;
213 it->second.connectionDegree = degree;
222 std::cout <<
"recieved: " << it->second.receivedTokens <<
" -> " << tokens << std::endl;
223 it->second.receivedTokens = tokens;
232 it->second.receivedTokens++;
240 it->second.receivedTokens--;
248 return it->second.receivedTokens;
258 std::cout <<
"sent: " << it->second.sentTokens <<
" -> " << tokens << std::endl;
259 it->second.sentTokens = tokens;
267 if(it !=
neighbors.end() && it->second.sentTokens >= 0)
268 it->second.sentTokens++;
276 return it->second.sentTokens;
281 unsigned int degree)
const
284 unsigned int subset = 0;
285 double maxCapacity = 0;
286 unsigned int dropDegree = 0;
291 if(it->first.getCapacity() <= capacity) {
293 if(it->first.getCapacity() > maxCapacity) {
295 dropDegree = it->second.connectionDegree;
302 (dropDegree > degree) &&
304 return candIt->first;