Avoid reinstantiating: VisibilityRestriction is not comparable

This commit is contained in:
Tony Garnock-Jones 2019-06-13 14:32:37 +01:00
parent 9f63d2e181
commit 6561c0b16e
1 changed files with 5 additions and 2 deletions

View File

@ -377,17 +377,20 @@ spawn named 'from-node-relay' {
during Observe(C.FromServer($addr, FromNode($node, $spec))) { during Observe(C.FromServer($addr, FromNode($node, $spec))) {
on start debug('?+', addr.toString(), node.toString(), spec.toString()); on start debug('?+', addr.toString(), node.toString(), spec.toString());
on stop debug('?-', addr.toString(), node.toString(), spec.toString()); on stop debug('?-', addr.toString(), node.toString(), spec.toString());
let matches = Map();
on asserted C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) { on asserted C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) {
// ^ TODO: Use real quoting instead of spec.toString() hack!! // ^ TODO: Use real quoting instead of spec.toString() hack!!
// TODO: Shouldn't the dataspace/client be doing the necessary quoting for us?? // TODO: Shouldn't the dataspace/client be doing the necessary quoting for us??
const a = Skeleton.instantiateAssertion(C.FromServer(addr, FromNode(node, spec)), vs); const a = Skeleton.instantiateAssertion(C.FromServer(addr, FromNode(node, spec)), vs);
matches = matches.set(vs, a);
debug('+', a.toString()); debug('+', a.toString());
currentFacet().actor.adhocAssert(a); currentFacet().actor.adhocAssert(a);
} }
on retracted C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) { on retracted C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) {
const a = Skeleton.instantiateAssertion(C.FromServer(addr, FromNode(node, spec)), vs); const a = matches.get(vs);
debug('-', a.toString()); debug('-', a && a.toString());
currentFacet().actor.adhocRetract(a); currentFacet().actor.adhocRetract(a);
matches = matches.remove(vs);
} }
on message C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) { on message C.FromServer(addr, RestrictedFromNode(node, spec.toString(), $vs)) {
const a = Skeleton.instantiateAssertion(C.FromServer(addr, FromNode(node, spec)), vs); const a = Skeleton.instantiateAssertion(C.FromServer(addr, FromNode(node, spec)), vs);