Skip to content

Commit

Permalink
#883: active: After deserialization msg, copy envelope bcast data fro…
Browse files Browse the repository at this point in the history
…m sys_msg to user_msg so it can be later used in user handler
  • Loading branch information
JacobDomagala committed Jan 21, 2021
1 parent 9d0d77e commit 13a449e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/vt/messaging/envelope/envelope_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ inline void envelopeInitEmpty(Envelope& env);
template <typename Env>
inline void envelopeInitCopy(Env& env, Env const& src_env);

/**
* \brief Copy broadcast related data
*
* \param[in,out] env the target envelope to copy to
* \param[in] env the original envelope to use as a copy
*/
template <typename Env>
inline void envelopeCopyBcastData(Env& env, Env const& src_env);

/**
* \brief Initialize/validate an envelope that has been received.
*
Expand Down
8 changes: 8 additions & 0 deletions src/vt/messaging/envelope/envelope_setup.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ inline void envelopeInitCopy(Env& env, Env const& src_env) {
envelopeSetIsLocked(env, false);
}

template <typename Env>
inline void envelopeCopyBcastData(Env& env, Env const& src_env) {
envelopeSetIsLocked(env, false);
envelopeSetDest(env, envelopeGetDest(src_env));
setBroadcastType(env);
envelopeSetIsLocked(env, true);
}

template <typename Env>
inline void envelopeInitRecv(Env& env) {
// Reset the local ref-count. The sender ref-count is not relevant.
Expand Down
6 changes: 6 additions & 0 deletions src/vt/serialization/messaging/serialized_messenger.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ template <typename UserMsgT, typename BaseEagerMsgT>
auto msg_data = sys_msg->payload.data();
auto user_msg = deserializeFullMessage<UserMsgT>(msg_data);

// Keep bcast related data in user_msg since it's sometimes
// needed in the handler
if (envelopeIsBcast(sys_msg->env)) {
envelopeCopyBcastData(user_msg->env, sys_msg->env);
}

vt_debug_print(
serial_msg, node,
"payloadMsgHandler: group={:x}, msg={}, handler={}, bytes={}, "
Expand Down

0 comments on commit 13a449e

Please sign in to comment.