Skip to content

Commit

Permalink
FlowMeasurementRecorder: Don't open packet event file if not requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Jan 5, 2024
1 parent c34bb82 commit 20056c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/inet/queueing/flow/FlowMeasurementRecorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ static bool matchesString(cMatchExpression& matchExpression, const char *string)

FlowMeasurementRecorder::~FlowMeasurementRecorder()
{
packetEventFile.closeArray();
packetEventFile.close();
if (measurePacketEvent) {
packetEventFile.closeArray();
packetEventFile.close();
}
}

cGate *FlowMeasurementRecorder::getRegistrationForwardingGate(cGate *gate)
Expand Down Expand Up @@ -59,8 +61,10 @@ void FlowMeasurementRecorder::initialize(int stage)
measureTransmissionTime = matchesString(measureMatcher, "transmissionTime");
measurePropagationTime = matchesString(measureMatcher, "propagationTime");
measurePacketEvent = matchesString(measureMatcher, "packetEvent");
packetEventFile.open(par("packetEventFileName").stringValue(), std::ios::out);
packetEventFile.openArray();
if (measurePacketEvent) {
packetEventFile.open(par("packetEventFileName").stringValue(), std::ios::out);
packetEventFile.openArray();
}
}
}

Expand Down

0 comments on commit 20056c3

Please sign in to comment.