Nixed premature optimization wherein a frequent premature optimizer, who we
will not name, was trying to allow certain authentications to proceed directly on the authenticator thread instead of making a round trip through the invoker. This resulted in those authentications trying to post their results from the authenticator thread, which is bad because all downstream messages should be posted from the distributed object thread. The only authentications that would "benefit" from this optimization were peer authentications of which there would be extremely few (currently one in our largest installation) compared to the hundreds of thousands of normal authentications, which have to make the invoker thread round trip as a matter of course. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4655 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -38,14 +38,14 @@ import com.threerings.presents.peer.net.PeerCreds;
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Handles authentication of peer servers and passes non-peer authentication
|
||||
* requests through to a normal authenticator.
|
||||
* Handles authentication of peer servers and passes non-peer authentication requests through to a
|
||||
* normal authenticator.
|
||||
*/
|
||||
public class PeerAuthenticator extends Authenticator
|
||||
{
|
||||
/**
|
||||
* Creates an authenticator that will handle peer authentications and pass
|
||||
* non-peer authentications through to the supplied delegate.
|
||||
* Creates an authenticator that will handle peer authentications and pass non-peer
|
||||
* authentications through to the supplied delegate.
|
||||
*/
|
||||
public PeerAuthenticator (PeerManager nodemgr, Authenticator delegate)
|
||||
{
|
||||
@@ -67,18 +67,8 @@ public class PeerAuthenticator extends Authenticator
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Invoker getInvoker ()
|
||||
{
|
||||
// The processing of peer authentication happens inline,
|
||||
// but other authentication will use the _delegate which will
|
||||
// probably use an Invoker.
|
||||
return null;
|
||||
}
|
||||
|
||||
// from abstract Authenticator
|
||||
protected void processAuthentication (
|
||||
AuthingConnection conn, AuthResponse rsp)
|
||||
protected void processAuthentication (AuthingConnection conn, AuthResponse rsp)
|
||||
throws PersistenceException
|
||||
{
|
||||
// here, we are ONLY authenticating peers
|
||||
@@ -89,8 +79,7 @@ public class PeerAuthenticator extends Authenticator
|
||||
rsp.getData().code = AuthResponseData.SUCCESS;
|
||||
|
||||
} else {
|
||||
log.warning("Received invalid peer auth request? " +
|
||||
"[creds=" + pcreds + "].");
|
||||
log.warning("Received invalid peer auth request? [creds=" + pcreds + "].");
|
||||
rsp.getData().code = AuthCodes.SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user