Skip to content

Commit 1a95d5e

Browse files
committed
Suspend processing of PTAG before starting the execution
When a ptag is received from the RTI before the execution, only updates TAG value of the federate and return. The remaining part of PTAG handling will be done in `_startExecuting`.
1 parent 3b18b49 commit 1a95d5e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/core/federation.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,14 @@ export class FederatedApp extends App {
19271927

19281928
// Send RTI a NET and wait for PTAG or TAG.
19291929
this.sendRTINextEventTag(this.util.getCurrentTag());
1930+
1931+
if (
1932+
this.greatestTimeAdvanceGrant.isSimultaneousWith(this.util.getStartTag())
1933+
) {
1934+
// PTAG for the start tag is already received, call _next immediately.
1935+
this._updateMaxLevel();
1936+
this._requestImmediateInvocationOfNext();
1937+
}
19301938
}
19311939

19321940
/**
@@ -2065,6 +2073,11 @@ export class FederatedApp extends App {
20652073
// Update the greatest time advance grant and update MLAA.
20662074
this.greatestTimeAdvanceGrant = ptag;
20672075
this._isLastTAGProvisional = true;
2076+
if (this._active !== true) {
2077+
// PTAG is received before starting execution, return.
2078+
// The pending process of PTAG will be done in _startExecuting.
2079+
return;
2080+
}
20682081
this._updateMaxLevel();
20692082
// Possibly insert a dummy event into the event queue if current time is behind.
20702083
if (this.util.getCurrentTag().isSmallerThan(ptag)) {

0 commit comments

Comments
 (0)