Implemented a Ray-proposed solution where we keep track of events that were

(pre-applied and) posted before we received our object but processed (and hence
dispatched to us) after we received our object.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4715 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-05-18 03:37:14 +00:00
parent db3fe80e9d
commit 9bcca099ac
10 changed files with 268 additions and 230 deletions
@@ -33,24 +33,6 @@ import com.threerings.presents.peer.net.PeerBootstrapData;
*/
public class PeerClient extends PresentsClient
{
@Override // documentation inherited
public synchronized void mapSubscrip (DObject object)
{
super.mapSubscrip(object);
if (object instanceof NodeObject) {
_peermgr.clientSubscribedToNode(_cloid);
}
}
@Override // documentation inherited
public synchronized void unmapSubscrip (int oid)
{
if (_subscrips.get(oid) instanceof NodeObject) {
_peermgr.clientUnsubscribedFromNode(_cloid);
}
super.unmapSubscrip(oid);
}
/**
* Creates a peer client and provides it with a reference to the peer
* manager. This is only done by the {@link PeerClientFactory}.
@@ -98,16 +80,22 @@ public class PeerClient extends PresentsClient
_cloid = _clobj.getOid();
}
@Override // documentation inherited
protected void clearSubscrips (boolean verbose)
@Override // from PresentsClient
protected void subscribedToObject (DObject object)
{
for (DObject object : _subscrips.values()) {
if (object instanceof NodeObject) {
_peermgr.clientUnsubscribedFromNode(_cloid);
break;
}
super.subscribedToObject(object);
if (object instanceof NodeObject) {
_peermgr.clientSubscribedToNode(_cloid);
}
}
@Override // from PresentsClient
protected void unsubscribedFromObject (DObject object)
{
super.unsubscribedFromObject(object);
if (object instanceof NodeObject) {
_peermgr.clientUnsubscribedFromNode(_cloid);
}
super.clearSubscrips(verbose);
}
protected PeerManager _peermgr;