MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ManageRequests

Method ManageRequests

libi2pd/NetDbRequests.cpp:215–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 }
214
215 void NetDbRequests::ManageRequests ()
216 {
217 uint64_t ts = i2p::util::GetMillisecondsSinceEpoch ();
218 for (auto it = m_RequestedDestinations.begin (); it != m_RequestedDestinations.end ();)
219 {
220 auto& dest = it->second;
221 if (dest->IsActive () || ts < dest->GetCreationTime () + REQUEST_CACHE_TIME)
222 {
223 if (!dest->IsExploratory ())
224 {
225 // regular request
226 bool done = false;
227 if (ts < dest->GetCreationTime () + MAX_REQUEST_TIME)
228 {
229 if (ts > dest->GetLastRequestTime () + (dest->IsSentDirectly () ? MIN_DIRECT_REQUEST_TIME : MIN_REQUEST_TIME))
230 // try next floodfill if no response after min interval
231 done = !SendNextRequest (dest);
232 }
233 else // request is expired
234 done = true;
235 if (done)
236 dest->Fail ();
237 it++;
238 }
239 else
240 {
241 // exploratory
242 if (ts >= dest->GetCreationTime () + MAX_EXPLORATORY_REQUEST_TIME)
243 {
244 dest->Fail ();
245 it = m_RequestedDestinations.erase (it); // delete expired exploratory request right a way
246 }
247 else
248 it++;
249 }
250 }
251 else
252 it = m_RequestedDestinations.erase (it);
253 }
254 }
255
256 bool NetDbRequests::SendNextRequest (std::shared_ptr<RequestedDestination> dest)
257 {

Callers

nothing calls this directly

Calls 7

GetLastRequestTimeMethod · 0.80
IsSentDirectlyMethod · 0.80
FailMethod · 0.80
IsActiveMethod · 0.45
GetCreationTimeMethod · 0.45
IsExploratoryMethod · 0.45

Tested by

no test coverage detected