Fixes for property setting via atomic test-and-set:
- Moved property testing, so that it happens before any propertySet events are dispatched. In the previous version, testing happened while processing the set event on the server - but since by that time client events have already been sent, it introduced the possibility of short-lived inconsistencies between client and server data models. - Introduced a separate EZ API call for test and set - not only does it perform the test, but unlike regular set, it does not cache the new value ahead of time. Instead the new value will have to arrive from the server, at some future point. - Trimmed PropertySetEvent and other handlers back down - they don't need to carry any of the test info around, after it's already been performed. Also cut redundant testing on the clients. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@195 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -35,7 +35,7 @@ public class PropertySetEvent extends NamedEvent
|
||||
override public function applyToObject (target :DObject) :Boolean
|
||||
{
|
||||
_oldValue =
|
||||
EZGameObject(target).applyPropertySet(_name, _data, _index, _testAndSet);
|
||||
EZGameObject(target).applyPropertySet(_name, _data, _index);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class PropertySetEvent extends NamedEvent
|
||||
super.readObject(ins);
|
||||
_index = ins.readInt();
|
||||
_data = EZObjectMarshaller.decode(ins.readObject());
|
||||
_testAndSet = ins.readBoolean();
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
@@ -78,7 +77,6 @@ public class PropertySetEvent extends NamedEvent
|
||||
super.writeObject(out);
|
||||
out.writeInt(_index);
|
||||
out.writeObject(_data);
|
||||
out.writeBoolean(_testAndSet);
|
||||
}
|
||||
|
||||
override protected function notifyListener (listener :Object) :void
|
||||
@@ -101,9 +99,6 @@ public class PropertySetEvent extends NamedEvent
|
||||
/** The client-side data that is assigned to this property. */
|
||||
protected var _data :Object;
|
||||
|
||||
/** When true, the property will only be set if its previous value was null. */
|
||||
protected var _testAndSet :Boolean;
|
||||
|
||||
/** The old value. */
|
||||
protected var _oldValue :Object;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user