Rejiggered the way things are handled when using a Client to proxy events from

another server. The PeerManager needs both to rewrite the oid of the events
before dispatching them and to assign an eventId to them so that they will not
be filtered by PresentsClient when deciding whether or not to send them along
to its client. Also fixed compound event dispatch in the process. Now proxy
subscribers will be notified once of a compound event rather than of each
individual internal event.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4729 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-06-13 22:37:53 +00:00
parent 097a53e534
commit c365afa2fc
3 changed files with 47 additions and 20 deletions
@@ -47,6 +47,7 @@ import com.threerings.presents.client.ClientObserver;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.DEvent;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.EntryAddedEvent;
import com.threerings.presents.dobj.EntryRemovedEvent;
@@ -702,7 +703,18 @@ public class PeerManager
public PeerNode (NodeRecord record)
{
_record = record;
_client = new Client(null, PresentsServer.omgr);
_client = new Client(null, PresentsServer.omgr) {
protected void adjustForProxy (DObject target, DEvent event) {
super.adjustForProxy(target, event);
// rewrite the event's target oid using the oid currently configured on the
// distributed object (we will have it mapped in our remote server's oid space,
// but it may have been remapped into the oid space of the local server)
event.setTargetOid(target.getOid());
// assign an eventId to this event so that our stale event detection code can
// properly deal with it
event.eventId = PresentsServer.omgr.getNextEventId(true);
}
};
_client.addClientObserver(this);
}