mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Unl change announcement to connected users. (#224)
Introduced json and bson messages for unl list announcement. When the unl set is modified send a json or bson unl list message (according to the user protocol) to all the connected users.
This commit is contained in:
@@ -417,4 +417,24 @@ namespace usr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send unl list to all the connected users.
|
||||
* @param unl_list Set of unl pubkeys.
|
||||
*/
|
||||
void announce_unl_list(const std::set<std::string> &unl_list)
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(ctx.users_mutex);
|
||||
|
||||
for (const auto &user : ctx.users)
|
||||
{
|
||||
const usr::connected_user &connected_user = user.second;
|
||||
msg::usrmsg::usrmsg_parser parser(connected_user.protocol);
|
||||
|
||||
std::vector<uint8_t> msg;
|
||||
parser.create_unl_list_container(msg, unl_list);
|
||||
|
||||
connected_user.session.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace usr
|
||||
Reference in New Issue
Block a user