File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ void Leach::start() {
5959 configureInterfaces ();
6060
6161 // schedules a random periodic event
62+ event->setKind (SELF);
6263 scheduleAt (simTime () + uniform (0.0 , par (" startupDelay" ).doubleValue ()),
6364 event);
6465}
@@ -106,6 +107,7 @@ void Leach::handleMessageWhenUp(cMessage *msg) {
106107 }
107108
108109 // schedule another self message every time new one is received by node
110+ event->setKind (SELF);
109111 scheduleAt (simTime () + roundDuration, event);
110112 // if node is receiving message
111113 } else if (check_and_cast<Packet*>(msg)->getTag <PacketProtocolTag>()->getProtocol ()
@@ -123,6 +125,7 @@ void Leach::handleMessageWhenDown(cMessage *msg) {
123125
124126void Leach::handleSelfMessage (cMessage *msg) {
125127 if (msg == event) {
128+ if (event->getKind () == SELF) {
126129 auto ctrlPkt = makeShared<LeachControlPkt>();
127130
128131 // Filling the LeachControlPkt fields
@@ -146,6 +149,7 @@ void Leach::handleSelfMessage(cMessage *msg) {
146149 send (packet, " ipOut" );
147150 packet = nullptr ;
148151 ctrlPkt = nullptr ;
152+ }
149153 } else {
150154 delete msg;
151155 }
You can’t perform that action at this time.
0 commit comments