| 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 | { |
nothing calls this directly
no test coverage detected