@@ -370,19 +370,6 @@ namespace llarp
370
370
});
371
371
}
372
372
373
- void NodeDB::fetch_rcs (std::vector<RouterID> needed, bt_control_response_hook func)
374
- {
375
- if (_router.is_stopping () || not _router.is_running ())
376
- {
377
- log ::debug (logcat, " NodeDB unable to continue RC fetch -- router is stopped!" );
378
- return post_rc_fetch (true );
379
- }
380
-
381
- log ::debug (
382
- logcat, " Dispatching FetchRC's request to {} for {} RCs!" , fetch_source.short_string (), needed.size ());
383
- _router.link_manager ()->fetch_rcs (fetch_source, FetchRC::serialize (std::move (needed)), std::move (func));
384
- }
385
-
386
373
void NodeDB::fetch_rcs ()
387
374
{
388
375
if (_router.is_stopping () || not _router.is_running ())
@@ -393,71 +380,36 @@ namespace llarp
393
380
394
381
cycle_fetch_source ();
395
382
396
- return fetch_rcs (get_expired_rcs (), [this , source = fetch_source](oxen::quic::message m) mutable {
397
- if (not m)
398
- {
399
- log ::warning (
400
- logcat, " RC fetch from {} {}" , source, m.timed_out ? " timed out" : " failed: {}" _format (m.view ()));
401
- }
402
- else
403
- {
404
- try
405
- {
406
- std::set<RemoteRC> rcs = FetchRC::deserialize_response (oxenc::bt_dict_consumer{m.body ()});
383
+ log ::debug (logcat, " Dispatching FetchRC's request to {}!" , fetch_source.short_string ());
407
384
408
- return rc_fetch_result (std::move (rcs));
409
- }
410
- catch (const std::exception & e)
385
+ _router.link_manager ()->fetch_rcs (
386
+ fetch_source,
387
+ FetchRC::serialize (get_expired_rcs ()),
388
+ [this , source = fetch_source](oxen::quic::message m) mutable {
389
+ if (not m)
411
390
{
412
- log ::warning (logcat, " Failed to parse RC fetch response from {}: {}" , source, e.what ());
391
+ log ::warning (
392
+ logcat,
393
+ " RC fetch from {} {}" ,
394
+ source,
395
+ m.timed_out ? " timed out" : " failed: {}" _format (m.view ()));
413
396
}
414
- }
397
+ else
398
+ {
399
+ try
400
+ {
401
+ std::set<RemoteRC> rcs = FetchRC::deserialize_response (oxenc::bt_dict_consumer{m.body ()});
415
402
416
- rc_fetch_result ();
417
- });
403
+ return rc_fetch_result (std::move (rcs));
404
+ }
405
+ catch (const std::exception & e)
406
+ {
407
+ log ::warning (logcat, " Failed to parse RC fetch response from {}: {}" , source, e.what ());
408
+ }
409
+ }
418
410
419
- // std::vector<RouterID> needed = get_expired_rcs();
420
-
421
- // cycle_fetch_source();
422
- // auto& src = fetch_source;
423
- // log::debug(logcat, "Dispatching FetchRC's request to {} for {} RCs!", src.short_string(), needed.size());
424
-
425
- // _router.link_manager()->fetch_rcs(
426
- // src, FetchRCMessage::serialize(needed), [this, source = fetch_source](oxen::quic::message m) mutable {
427
- // if (not m)
428
- // {
429
- // log::warning(
430
- // logcat,
431
- // "RC fetch from {} {}",
432
- // source,
433
- // m.timed_out ? "timed out" : "failed: {}"_format(m.view()));
434
- // }
435
- // else
436
- // {
437
- // try
438
- // {
439
- // std::set<RemoteRC> rcs;
440
- // oxenc::bt_dict_consumer btdc{m.body()};
441
-
442
- // btdc.required("r");
443
-
444
- // {
445
- // auto sublist = btdc.consume_list_consumer();
446
-
447
- // while (not sublist.is_finished())
448
- // rcs.emplace(sublist.consume_dict_data());
449
- // }
450
-
451
- // return rc_fetch_result(std::move(rcs));
452
- // }
453
- // catch (const std::exception& e)
454
- // {
455
- // log::warning(logcat, "Failed to parse RC fetch response from {}: {}", source, e.what());
456
- // }
457
- // }
458
-
459
- // rc_fetch_result();
460
- // });
411
+ rc_fetch_result ();
412
+ });
461
413
}
462
414
463
415
void NodeDB::rc_fetch_result (std::optional<std::set<RemoteRC>> result)
@@ -501,7 +453,7 @@ namespace llarp
501
453
auto & src = fetch_source;
502
454
log ::debug (logcat, " New fetch source is {}" , src);
503
455
504
- auto send_hook = [this , src](const bt_control_stream& control) mutable {
456
+ auto send_hook = [this , src = src ](const bt_control_stream& control) mutable {
505
457
std::ranges::for_each (rid_sources.begin (), rid_sources.end (), [&](const RouterID& target) mutable {
506
458
if (target == src)
507
459
return ;
0 commit comments