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

Method CreateRequest

libi2pd/NetDbRequests.cpp:159–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157 }
158
159 std::shared_ptr<RequestedDestination> NetDbRequests::CreateRequest (const IdentHash& destination,
160 bool isExploratory, bool direct, RequestedDestination::RequestComplete requestComplete)
161 {
162 // request RouterInfo directly
163 auto dest = m_RequestedDestinationsPool.AcquireSharedMt (destination, isExploratory, direct);
164 if (requestComplete)
165 dest->AddRequestComplete (requestComplete);
166
167 auto ret = m_RequestedDestinations.emplace (destination, dest);
168 if (!ret.second) // not inserted
169 {
170 dest->ResetRequestComplete (); // don't call requestComplete in destructor
171 dest = ret.first->second; // existing one
172 if (requestComplete)
173 {
174 if (dest->IsActive ())
175 dest->AddRequestComplete (requestComplete);
176 else
177 requestComplete (nullptr);
178 }
179 return nullptr;
180 }
181 return dest;
182 }
183
184 void NetDbRequests::RequestComplete (const IdentHash& ident, std::shared_ptr<RouterInfo> r)
185 {

Callers

nothing calls this directly

Calls 4

AcquireSharedMtMethod · 0.80
AddRequestCompleteMethod · 0.80
ResetRequestCompleteMethod · 0.80
IsActiveMethod · 0.45

Tested by

no test coverage detected