Commit bdf154ae authored by Mirko Stoffers's avatar Mirko Stoffers
Browse files

Fix for packet-durations in Horizon.

durations of cPackets (not to confuse with Horizon processing durations)
were not properly set when Horizon was turned on.
parent eb21e3cf
......@@ -415,7 +415,7 @@ cPacket::cPacket(const char *name, short k, int64 l) : cMessage(name, k)
{
len = l;
encapmsg = NULL;
eventDuration = 0;
duration = 0;
sharecount = 0;
}
......
......@@ -501,6 +501,8 @@ int cSimpleModule::sendDelayed(cMessage *msg, simtime_t delay, cGate *outgate)
// set message parameters and send it
//
msg->setSentFrom(this, outgate->getId(), arrivalTime);
if (msg->isPacket())
((cPacket *)msg)->setDuration(0);
bool keepit = outgate->deliver(msg, arrivalTime);
if (!keepit)
delete msg;
......@@ -667,6 +669,12 @@ int cSimpleModule::sendDirect(cMessage *msg, simtime_t propdelay, simtime_t dura
// set message parameters and send it
msg->setSentFrom(this, -1, now);
if (msg->isPacket())
((cPacket *)msg)->setDuration(duration);
else if (duration!=SIMTIME_ZERO)
throw cRuntimeError("sendDirect(): cannot send non-packet message (%s)%s when nonzero duration is specified",
msg->getClassName(), msg->getName());
bool keepit = togate->deliver(msg, arrivalTime);
if (!keepit)
delete msg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment