From e73ebfd15193102eb0975b1247b19fb024f893f7 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 16 Sep 2019 12:36:38 -0700 Subject: [PATCH] ircd::m::fetch: Throw on loop break to properly set request.eptr and finish(). --- modules/m_fetch.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/m_fetch.cc b/modules/m_fetch.cc index b4398d76b..612314663 100644 --- a/modules/m_fetch.cc +++ b/modules/m_fetch.cc @@ -425,9 +425,13 @@ try break; } - assert(!request.finished); - finish(request); - return false; + throw m::NOT_FOUND + { + "Cannot find any server to fetch %s in %s in %zu attempts", + string_view{request.opts.event_id}, + string_view{request.opts.room_id}, + request.attempted.size(), + }; } catch(...) { @@ -592,14 +596,7 @@ ircd::m::fetch::select_random_origin(request &request) }}; request.origin = {}; - if(!origins.random(closure, proffer) || !request.origin) - throw m::NOT_FOUND - { - "Cannot find any server to fetch %s in %s", - string_view{request.opts.event_id}, - string_view{request.opts.room_id}, - }; - + origins.random(closure, proffer); return request.origin; }