0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

modules/federation/sender: Consistent origin from node::id; fix curtxn assignment.

This commit is contained in:
Jason Volk 2018-03-21 16:35:30 -07:00
parent df7b6f0ca9
commit 1846dd379d
2 changed files with 11 additions and 2 deletions

View file

@ -195,6 +195,7 @@ try
txns.emplace_back(*this, std::move(content), std::move(opts)); txns.emplace_back(*this, std::move(content), std::move(opts));
const unwind::nominal::assertion na; const unwind::nominal::assertion na;
curtxn = &txns.back();
q.clear(); q.clear();
recv_action.notify_one(); recv_action.notify_one();
return true; return true;
@ -404,8 +405,11 @@ recv_timeout(txn &txn,
void void
remove_node(const node &node) remove_node(const node &node)
{ {
const string_view &id{node.id}; const auto it
const auto it{nodes.find(id)}; {
nodes.find(node.origin())
};
assert(it != end(nodes)); assert(it != end(nodes));
nodes.erase(it); nodes.erase(it);
} }

View file

@ -80,6 +80,11 @@ struct node
txn *curtxn {nullptr}; txn *curtxn {nullptr};
bool err {false}; bool err {false};
string_view origin() const
{
return id.host();
};
bool flush(); bool flush();
void push(std::shared_ptr<unit>); void push(std::shared_ptr<unit>);