PresentsClient -> PresentsSession (Jamie's suggestion) and associated changes
on down the client. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5508 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -27,7 +27,7 @@ import com.threerings.presents.net.AuthRequest;
|
||||
import com.threerings.presents.peer.net.PeerCreds;
|
||||
import com.threerings.presents.server.ClientFactory;
|
||||
import com.threerings.presents.server.ClientResolver;
|
||||
import com.threerings.presents.server.PresentsClient;
|
||||
import com.threerings.presents.server.PresentsSession;
|
||||
|
||||
/**
|
||||
* Handles resolution of peer servers and passes non-peer resolution requests through to a normal
|
||||
@@ -41,10 +41,10 @@ public class PeerClientFactory implements ClientFactory
|
||||
}
|
||||
|
||||
// documentation inherited from interface ClientFactory
|
||||
public Class<? extends PresentsClient> getClientClass (AuthRequest areq)
|
||||
public Class<? extends PresentsSession> getClientClass (AuthRequest areq)
|
||||
{
|
||||
if (areq.getCredentials() instanceof PeerCreds) {
|
||||
return PeerClient.class;
|
||||
return PeerSession.class;
|
||||
} else {
|
||||
return _delegate.getClientClass(areq);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.ClientManager;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.PresentsClient;
|
||||
import com.threerings.presents.server.PresentsSession;
|
||||
import com.threerings.presents.server.PresentsDObjectMgr;
|
||||
import com.threerings.presents.server.ReportManager;
|
||||
import com.threerings.presents.server.ShutdownManager;
|
||||
@@ -643,7 +643,7 @@ public abstract class PeerManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link PeerClient}s when clients subscribe to the {@link NodeObject}.
|
||||
* Called by {@link PeerSession}s when clients subscribe to the {@link NodeObject}.
|
||||
*/
|
||||
public void clientSubscribedToNode (int cloid)
|
||||
{
|
||||
@@ -651,7 +651,7 @@ public abstract class PeerManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link PeerClient}s when clients unsubscribe from the {@link NodeObject}.
|
||||
* Called by {@link PeerSession}s when clients unsubscribe from the {@link NodeObject}.
|
||||
*/
|
||||
public void clientUnsubscribedFromNode (int cloid)
|
||||
{
|
||||
@@ -768,7 +768,7 @@ public abstract class PeerManager
|
||||
}
|
||||
|
||||
// from interface ClientManager.ClientObserver
|
||||
public void clientSessionDidStart (PresentsClient client)
|
||||
public void clientSessionDidStart (PresentsSession client)
|
||||
{
|
||||
if (ignoreClient(client)) {
|
||||
return;
|
||||
@@ -790,7 +790,7 @@ public abstract class PeerManager
|
||||
}
|
||||
|
||||
// from interface ClientManager.ClientObserver
|
||||
public void clientSessionDidEnd (PresentsClient client)
|
||||
public void clientSessionDidEnd (PresentsSession client)
|
||||
{
|
||||
if (ignoreClient(client)) {
|
||||
return;
|
||||
@@ -872,10 +872,10 @@ public abstract class PeerManager
|
||||
* the beginning and end of the client session, so this method should return the same value
|
||||
* both times.
|
||||
*/
|
||||
protected boolean ignoreClient (PresentsClient client)
|
||||
protected boolean ignoreClient (PresentsSession client)
|
||||
{
|
||||
// if this is another peer, don't publish their info
|
||||
return (client instanceof PeerClient);
|
||||
return (client instanceof PeerSession);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -947,7 +947,7 @@ public abstract class PeerManager
|
||||
/**
|
||||
* Initializes the supplied client info for the supplied client.
|
||||
*/
|
||||
protected void initClientInfo (PresentsClient client, ClientInfo info)
|
||||
protected void initClientInfo (PresentsSession client, ClientInfo info)
|
||||
{
|
||||
info.username = client.getCredentials().getUsername();
|
||||
}
|
||||
@@ -955,7 +955,7 @@ public abstract class PeerManager
|
||||
/**
|
||||
* Called when a client ends their session to clear their information from our node object.
|
||||
*/
|
||||
protected void clearClientInfo (PresentsClient client, ClientInfo info)
|
||||
protected void clearClientInfo (PresentsSession client, ClientInfo info)
|
||||
{
|
||||
_nodeobj.removeFromClients(info.getKey());
|
||||
}
|
||||
|
||||
+17
-20
@@ -29,28 +29,27 @@ import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.net.BootstrapData;
|
||||
import com.threerings.presents.peer.data.NodeObject;
|
||||
import com.threerings.presents.peer.net.PeerBootstrapData;
|
||||
import com.threerings.presents.server.PresentsClient;
|
||||
import com.threerings.presents.server.PresentsSession;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Manages a peer connection.
|
||||
* Manages a peer session.
|
||||
*/
|
||||
public class PeerClient extends PresentsClient
|
||||
public class PeerSession extends PresentsSession
|
||||
{
|
||||
/**
|
||||
* Creates a peer client and provides it with a reference to the peer
|
||||
* manager. This is only done by the {@link PeerClientFactory}.
|
||||
* Creates a peer session and provides it with a reference to the peer manager. This is only
|
||||
* done by the {@link PeerClientFactory}.
|
||||
*/
|
||||
@Inject public PeerClient (PeerManager peermgr)
|
||||
@Inject public PeerSession (PeerManager peermgr)
|
||||
{
|
||||
_peermgr = peermgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived client classes can override this member to create derived
|
||||
* bootstrap data classes that contain extra bootstrap information, if
|
||||
* desired.
|
||||
* Derived classes can override this member to create derived bootstrap data classes that
|
||||
* contain extra bootstrap information, if desired.
|
||||
*/
|
||||
@Override
|
||||
protected BootstrapData createBootstrapData ()
|
||||
@@ -59,14 +58,12 @@ public class PeerClient extends PresentsClient
|
||||
}
|
||||
|
||||
/**
|
||||
* Derived client classes can override this member to populate the
|
||||
* bootstrap data with additional information. They should be sure to
|
||||
* call <code>super.populateBootstrapData</code> before doing their
|
||||
* own populating, however.
|
||||
* Derived classes can override this member to populate the bootstrap data with additional
|
||||
* information. They should be sure to call <code>super.populateBootstrapData</code> before
|
||||
* doing their own populating, however.
|
||||
*
|
||||
* <p><em>Note:</em> This function will be called on the dobjmgr
|
||||
* thread which means that object manipulations are OK, but client
|
||||
* instance manipulations must be done carefully.
|
||||
* <p><em>Note:</em> This function will be called on the dobjmgr thread which means that object
|
||||
* manipulations are OK, but client instance manipulations must be done carefully.
|
||||
*/
|
||||
@Override
|
||||
protected void populateBootstrapData (BootstrapData data)
|
||||
@@ -87,7 +84,7 @@ public class PeerClient extends PresentsClient
|
||||
_cloid = _clobj.getOid();
|
||||
}
|
||||
|
||||
@Override // from PresentsClient
|
||||
@Override // from PresentsSession
|
||||
protected void subscribedToObject (DObject object)
|
||||
{
|
||||
super.subscribedToObject(object);
|
||||
@@ -96,7 +93,7 @@ public class PeerClient extends PresentsClient
|
||||
}
|
||||
}
|
||||
|
||||
@Override // from PresentsClient
|
||||
@Override // from PresentsSession
|
||||
protected void unsubscribedFromObject (DObject object)
|
||||
{
|
||||
super.unsubscribedFromObject(object);
|
||||
@@ -105,14 +102,14 @@ public class PeerClient extends PresentsClient
|
||||
}
|
||||
}
|
||||
|
||||
@Override // from PresentsClient
|
||||
@Override // from PresentsSession
|
||||
protected Throttle createIncomingMessageThrottle ()
|
||||
{
|
||||
// more than 100 messages per second and we complain about it
|
||||
return new Throttle(100, 1000L);
|
||||
}
|
||||
|
||||
@Override // from PresentsClient
|
||||
@Override // from PresentsSession
|
||||
protected void handleThrottleExceeded ()
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
Reference in New Issue
Block a user