Skip to content

Commit f062b9d

Browse files
committed
Do not insert unnecessary dummy events when receiving ptag
Those events are only needed when the current tag is behind the ptag.
1 parent 45d52d4 commit f062b9d

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/core/federation.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,7 @@ export class FederatedApp extends App {
13811381
() => `Adding dummy event for time: ${physicalTime}`
13821382
);
13831383
this._addDummyEvent(new Tag(physicalTime));
1384+
// Notify the NET to the RTI.
13841385
this.sendRTINextEventTag(new Tag(physicalTime));
13851386
return false;
13861387
}
@@ -1702,6 +1703,7 @@ export class FederatedApp extends App {
17021703

17031704
/**
17041705
* @override
1706+
* Do the steps needed for the new logical tag.
17051707
* Enqueue network port absent reactions and update max level for the new tag.
17061708
*/
17071709
protected _startTimeStep(): void {
@@ -2060,14 +2062,21 @@ export class FederatedApp extends App {
20602062
ptag
20612063
)}.`;
20622064
});
2063-
// Update the greatest time advance grant and immediately
2064-
// wake up _next, in case it was blocked by the old time advance grant.
2065-
// Add a dummy event to send port absent messages if there is no scheduled
2066-
// reactions at the given tag.
2065+
// Update the greatest time advance grant and update MLAA.
20672066
this.greatestTimeAdvanceGrant = ptag;
20682067
this._isLastTAGProvisional = true;
20692068
this._updateMaxLevel();
2070-
this._addDummyEvent(ptag);
2069+
// Possibly insert a dummy event into the event queue if current time is behind.
2070+
if (this.util.getCurrentTag().isSmallerThan(ptag)) {
2071+
this._addDummyEvent(ptag);
2072+
Log.debug(this, () => {
2073+
return (
2074+
`At tag ${this.util.getCurrentTag()}, inserting the event queue a dummy event ` +
2075+
`with tag ${ptag}.`
2076+
);
2077+
});
2078+
}
2079+
// Wake up _next, in case it was blocked by the old time advance grant.
20712080
this._requestImmediateInvocationOfNext();
20722081
});
20732082

src/core/reactor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,7 @@ export class App extends Reactor {
23012301
}
23022302

23032303
/**
2304+
* Do the steps needed for the new logical tag.
23042305
* This function is overriden by federation.ts.
23052306
*/
23062307
protected _startTimeStep(): void {
@@ -2414,6 +2415,7 @@ export class App extends Reactor {
24142415
// Advance logical time.
24152416
this._advanceTime(nextEvent.tag);
24162417

2418+
// Start time step.
24172419
this._startTimeStep();
24182420
}
24192421
// Start processing events.

0 commit comments

Comments
 (0)