MCPcopy Create free account
hub / github.com/brainboxdotcc/DPP / process_commit

Method process_commit

src/dpp/dave/session.cpp:320–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320roster_variant session::process_commit(std::vector<uint8_t> commit) noexcept
321try {
322 creator.log(dpp::ll_debug, "Processing commit");
323
324 auto commit_message = ::mlspp::tls::get<::mlspp::MLSMessage>(commit);
325
326 if (!can_process_commit(commit_message)) {
327 creator.log(dpp::ll_warning, "process_commit called with unprocessable MLS commit");
328 return ignored_t{};
329 }
330
331 // in case we're the sender of this commit
332 // we need to pull the cached state from our outbound cache
333 std::optional<::mlspp::State> optional_cached_state = std::nullopt;
334 if (outbound_cached_group_state) {
335 optional_cached_state = *(outbound_cached_group_state.get());
336 }
337
338 auto new_state = state_with_proposals->handle(commit_message, optional_cached_state);
339 if (!new_state) {
340 creator.log(dpp::ll_warning, "MLS commit handling did not produce a new state");
341 return failed_t{};
342 }
343
344 creator.log(dpp::ll_debug, "Successfully processed MLS commit, updating state; our leaf index is " + std::to_string(new_state->index().val) + "; current epoch is " + std::to_string(new_state->epoch()));
345
346 roster_map ret = replace_state(std::make_unique<::mlspp::State>(std::move(*new_state)));
347
348 // reset the outbound cached group since we handled the commit for this epoch
349 outbound_cached_group_state.reset();
350 clear_pending_state();
351
352 return ret;
353}
354catch (const std::exception& e) {
355 creator.log(dpp::ll_warning, "Failed to process MLS commit: " + std::string(e.what()));
356 TRACK_MLS_ERROR(e.what());
357 return failed_t{};
358}
359
360std::optional<roster_map> session::process_welcome(std::vector<uint8_t> welcome, std::set<dpp::snowflake> const& recognised_user_ids) noexcept
361try {

Callers 1

handle_frameMethod · 0.80

Calls 9

to_stringFunction · 0.85
stringFunction · 0.85
logMethod · 0.45
getMethod · 0.45
handleMethod · 0.45
indexMethod · 0.45
epochMethod · 0.45
resetMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected