MCPcopy Create free account
hub / github.com/chronoxor/CppServer / onReceiveReject

Method onReceiveReject

proto/simple_protocol.cpp:355–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355bool Client::onReceiveReject(const ::simple::SimpleReject& reject)
356{
357 std::scoped_lock locker(this->_lock);
358
359 auto it_SimpleResponse = _requests_by_id_SimpleResponse.find(reject.id);
360 if (it_SimpleResponse != _requests_by_id_SimpleResponse.end())
361 {
362 auto timestamp = std::get<0>(it_SimpleResponse->second);
363 [[maybe_unused]] auto timespan = std::get<1>(it_SimpleResponse->second);
364 auto& promise = std::get<2>(it_SimpleResponse->second);
365 promise.set_exception(std::make_exception_ptr(std::runtime_error(reject.string())));
366 _requests_by_id_SimpleResponse.erase(reject.id);
367 _requests_by_timestamp_SimpleResponse.erase(timestamp);
368 return true;
369 }
370
371 return false;
372}
373
374void Client::reset_requests()
375{

Callers

nothing calls this directly

Calls 3

endMethod · 0.80
eraseMethod · 0.80
stringMethod · 0.45

Tested by

no test coverage detected