0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-30 02:32:43 +01:00

modules/s_fetch: Fix request set insertion.

This commit is contained in:
Jason Volk 2019-04-30 13:11:21 -07:00
parent a931a7f631
commit 4a22071be3

View file

@ -64,13 +64,16 @@ ircd::m::fetch::submit(const m::event::id &event_id,
requests.lower_bound(string_view(event_id)) requests.lower_bound(string_view(event_id))
}; };
if(it == end(requests) || it->event_id != event_id) try if(it != end(requests) && it->event_id == event_id)
{
assert(it->room_id == room_id);
return false;
}
else try
{ {
it = requests.emplace_hint(it, room_id, event_id, bufsz, std::forward<args>(a)...); it = requests.emplace_hint(it, room_id, event_id, bufsz, std::forward<args>(a)...);
auto &request(const_cast<fetch::request &>(*it)); auto &request(const_cast<fetch::request &>(*it));
while(!start(request)) while(!start(request)) request.origin = {};
request.origin = {};
return true; return true;
} }
catch(const std::exception &e) catch(const std::exception &e)
@ -86,7 +89,4 @@ ircd::m::fetch::submit(const m::event::id &event_id,
requests.erase(it); requests.erase(it);
return false; return false;
}; };
assert(it->room_id == room_id);
return false;
} }