Terminate actors when they have no more facets left.
This commit is contained in:
parent
dea733911d
commit
3c124633b3
|
@ -33,6 +33,13 @@ Actor.prototype.addFacet = function(facet) {
|
||||||
this.facets = this.facets.add(facet);
|
this.facets = this.facets.add(facet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Actor.prototype.removeFacet = function(facet) {
|
||||||
|
this.facets = this.facets.remove(facet);
|
||||||
|
if (this.facets.isEmpty()) {
|
||||||
|
Network.exit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
function createFacet() {
|
function createFacet() {
|
||||||
|
@ -130,6 +137,7 @@ Facet.prototype.terminate = function() {
|
||||||
});
|
});
|
||||||
Network.stateChange(aggregate);
|
Network.stateChange(aggregate);
|
||||||
this.endpoints = Immutable.Map();
|
this.endpoints = Immutable.Map();
|
||||||
|
this.actor.removeFacet(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue