Acknowledge endpoint Clear with an End; avoids late Add/Del messing things up

This commit is contained in:
Tony Garnock-Jones 2019-06-06 15:10:48 +01:00
parent 49821022f0
commit 652812471e
3 changed files with 7 additions and 5 deletions

View File

@ -95,7 +95,9 @@ spawn named '@syndicate-lang/server/federation/LocalLinkFactory' {
msg: (vs) => sendFromPOA(W.Msg(ep, vs)), msg: (vs) => sendFromPOA(W.Msg(ep, vs)),
}); });
assert P.Envelope(scope, Observe(spec)); assert P.Envelope(scope, Observe(spec));
stop on message P.Envelope(managementScope, P.ToPOA(sessionId, W.Clear(ep))); stop on message P.Envelope(managementScope, P.ToPOA(sessionId, W.Clear(ep))) {
sendFromPOA(W.End(ep));
}
} }
} }
@ -338,8 +340,7 @@ spawn named '@syndicate-lang/server/federation/ScopeFactory' {
// summarise(); // summarise();
} }
on message P.Envelope(managementScope, P.ToPOA(linkid, W.Clear($localid))) { on message P.Envelope(managementScope, P.FromPOA(linkid, W.End($localid))) {
// NB ToPOA, not FromPOA!
(this.linkMatches.get(localid) || Set()).forEach((captures) => { (this.linkMatches.get(localid) || Set()).forEach((captures) => {
removeMatch(localid, captures, linkid); removeMatch(localid, captures, linkid);
}); });

View File

@ -14,6 +14,7 @@ message type Message(body);
message type Add(endpointName, captures); message type Add(endpointName, captures);
message type Del(endpointName, captures); message type Del(endpointName, captures);
message type Msg(endpointName, captures); message type Msg(endpointName, captures);
message type End(endpointName);
message type Err(detail); message type Err(detail);
message type Ping(); message type Ping();
@ -33,7 +34,7 @@ Object.assign(module.exports, {
Connect, Peer, Connect, Peer,
Commit, Commit,
Assert, Clear, Message, Assert, Clear, Message,
Add, Del, Msg, Err, Add, Del, Msg, Err, End,
Ping, Pong, Ping, Pong,
makeDecoder, makeDecoder,
}); });

View File

@ -115,7 +115,7 @@ spawn named '@syndicate-lang/server/server/POAHandler' {
this.assertion = newAssertion; this.assertion = newAssertion;
}); });
on message P.FromPOA(connId, W.Clear(ep)) inboundTurn.extend(() => { on message P.FromPOA(connId, W.Clear(ep)) inboundTurn.extend(() => {
epFacet.stop(); epFacet.stop(() => { outboundTurn.extend(W.End(ep)); });
}); });
} }
} }