Skip to content

Commit

Permalink
TcpEchoAppThread: Changed to always set the CreationTimeTag timestamp…
Browse files Browse the repository at this point in the history
… to the current simulation time.
  • Loading branch information
levy committed Oct 10, 2023
1 parent 546dadb commit 8fefe3b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/inet/applications/tcpapp/TcpEchoApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

#include "inet/applications/tcpapp/TcpEchoApp.h"

#include "inet/common/lifecycle/ModuleOperations.h"
#include "inet/common/ModuleAccess.h"
#include "inet/common/packet/Packet_m.h"
#include "inet/common/ProtocolTag_m.h"
#include "inet/common/Simsignals.h"
#include "inet/common/lifecycle/ModuleOperations.h"
#include "inet/common/packet/Packet_m.h"
#include "inet/common/socket/SocketTag_m.h"
#include "inet/common/TimeTag_m.h"
#include "inet/transportlayer/contract/tcp/TcpCommand_m.h"

namespace inet {
Expand Down Expand Up @@ -115,13 +116,18 @@ void TcpEchoAppThread::dataArrived(Packet *rcvdPkt, bool urgent)
outPkt->addTag<SocketReq>()->setSocketId(socketId);

if (echoAppModule->echoFactor == 1.0) {
outPkt->insertAtBack(rcvdPkt->peekDataAt(B(0), B(rcvdBytes)));
auto content = rcvdPkt->peekDataAt(B(0), B(rcvdBytes))->dupShared();
content->removeTagsWherePresent<CreationTimeTag>(b(0), content->getChunkLength());
content->addTag<CreationTimeTag>()->setCreationTime(simTime());
outPkt->insertAtBack(content);
}
else {
int64_t outByteLen = rcvdBytes * echoAppModule->echoFactor;
if (outByteLen < 1)
outByteLen = 1;
outPkt->insertAtBack(makeShared<ByteCountChunk>(B(outByteLen)));
auto content = makeShared<ByteCountChunk>(B(outByteLen));
content->addTag<CreationTimeTag>()->setCreationTime(simTime());
outPkt->insertAtBack(content);
}
if (echoAppModule->delay == 0) {
sendDown(outPkt);
Expand Down

0 comments on commit 8fefe3b

Please sign in to comment.