checker_side_.dispatch(); // The app may send messages while processing the transition
if (new_transition) {
- std::stringstream stream(answer.buffer);
+ std::stringstream stream(answer.buffer.data());
return deserialize_transition(aid, times_considered, stream);
} else
return nullptr;
} else {
stream << (short)mc::Transition::Type::UNKNOWN;
}
- xbt_assert(stream.str().size() < sizeof(answer.buffer) - 1,
+ std::string str = stream.str();
+ xbt_assert(str.size() + 1 <= answer.buffer.size(),
"The serialized simcall is too large for the buffer. Please fix the code.");
- strncpy(answer.buffer, stream.str().c_str(), sizeof(answer.buffer) - 1);
+ strncpy(answer.buffer.data(), str.c_str(), answer.buffer.size() - 1);
+ answer.buffer.back() = '\0';
- XBT_DEBUG("send SIMCALL_EXECUTE_ANSWER(%s) ~> '%s'", actor->get_cname(), answer.buffer);
+ XBT_DEBUG("send SIMCALL_EXECUTE_ANSWER(%s) ~> '%s'", actor->get_cname(), str.c_str());
xbt_assert(channel_.send(answer) == 0, "Could not send response");
// The client may send some messages to the server while processing the transition
SIMCALL_EXECUTE_ANSWER, SIMCALL_IS_VISIBLE, SIMCALL_IS_VISIBLE_ANSWER, ASSERTION_FAILED,
ACTOR_ENABLED, ACTOR_ENABLED_REPLY, FINALIZE);
-#define SIMCALL_SERIALIZATION_BUFFER_SIZE 2048
-
} // namespace mc
} // namespace simgrid
constexpr unsigned MC_MESSAGE_LENGTH = 512;
+constexpr unsigned SIMCALL_SERIALIZATION_BUFFER_SIZE = 2048;
/** Basic structure for a MC message
*
};
struct s_mc_message_simcall_execute_answer_t {
simgrid::mc::MessageType type;
- char buffer[SIMCALL_SERIALIZATION_BUFFER_SIZE];
+ std::array<char, SIMCALL_SERIALIZATION_BUFFER_SIZE> buffer;
};
struct s_mc_message_restore_t {