|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.samskivert.util.LoopingThread
com.threerings.nio.conman.ConnectionManager
com.threerings.presents.server.net.PresentsConnectionManager
public class PresentsConnectionManager
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.nio.conman.ConnectionManager |
|---|
ConnectionManager.OverflowQueue, ConnectionManager.PartialWriteHandler |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected Invoker |
_authInvoker
|
protected Authenticator |
_author
Handles client authentication. |
protected List<ChainedAuthenticator> |
_authors
|
protected Queue<AuthingConnection> |
_authq
|
protected ClientManager |
_clmgr
|
protected Queue<Tuple<Connection,InetSocketAddress>> |
_connectq
|
protected ByteBuffer |
_databuf
|
protected Queue<Tuple<PresentsConnection,byte[]>> |
_dataq
|
protected ByteArrayOutputStream |
_flattener
|
protected FramingOutputStream |
_framer
|
protected PresentsConMgrStats |
_lastStats
A snapshot of our runtime stats as of our last report. |
protected PresentsDObjectMgr |
_omgr
|
protected PrivateKey |
_privateKey
|
| Fields inherited from class com.threerings.nio.conman.ConnectionManager |
|---|
_acceptedq, _connections, _deathq, _handlers, _idleTime, _lastDebugStamp, _oflowHandler, _oflowqs, _onExit, _outbuf, _outq, _selectLoopTime, _selector, _selectorSelector, _stats, ASYNC_CLOSE_REQUEST, DEBUG_REPORT, DEBUG_REPORT_INTERVAL, LATENCY_GRACE |
| Fields inherited from class com.samskivert.util.LoopingThread |
|---|
_running |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
PresentsConnectionManager(Lifecycle cycle,
ReportManager repmgr)
|
|
| Method Summary | |
|---|---|
void |
addChainedAuthenticator(ChainedAuthenticator author)
Adds an authenticator to the authentication chain. |
void |
appendReport(StringBuilder report,
long now,
long sinceLast,
boolean reset)
Requests that this reporter append its report to the supplied string buffer. |
protected void |
authenticateConnection(AuthingConnection conn)
Performs the authentication process on the specified connection. |
protected void |
connectionClosed(Connection conn)
Called by a connection when it discovers that it's closed. |
protected void |
connectionFailed(Connection conn,
IOException ioe)
Called by a connection if it experiences a network failure. |
protected DatagramSequencer |
createDatagramSequencer()
Creates a datagram sequencer for use by a Connection. |
PrivateKey |
getPrivateKey()
Returns the private key used in secure authentication. |
PresentsConMgrStats |
getStats()
Returns our current runtime statistics. |
protected void |
handleAcceptedSocket(SocketChannel channel)
Starts an accepted socket down the path to authorization. |
protected int |
handleDatagram(DatagramChannel listener,
long when)
Called when a datagram message is ready to be read off its channel. |
protected void |
handleIncoming(long iterStamp)
|
boolean |
isRunning()
|
void |
openOutgoingConnection(Connection conn,
String hostname,
int port)
Opens an outgoing connection to the supplied address. |
protected boolean |
postDatagram(PresentsConnection conn,
Message msg)
Helper function for postMessage(com.threerings.presents.server.net.PresentsConnection, com.threerings.presents.net.Message); handles posting the message as a datagram. |
protected void |
postMessage(PresentsConnection conn,
Message msg)
Called by a connection when it has a downstream message that needs to be delivered. |
protected void |
processAuthedConnections(long iterStamp)
Converts connections that have completed the authentication process into full running connections and notifies the client manager that new connections have been established. |
protected void |
sendOutgoingMessages(long iterStamp)
Writes all queued overflow and normal messages to their respective sockets. |
boolean |
setPrivateKey(PrivateKey key)
Sets the private key if the ciphers are supported. |
boolean |
setPrivateKey(String key)
Sets the private key if the ciphers are supported. |
protected void |
startOutgoingConnection(Connection conn,
InetSocketAddress addr)
Starts the connection process for an outgoing connection. |
protected boolean |
writeDatagram(PresentsConnection conn,
byte[] data)
Sends a datagram to the specified connection. |
| Methods inherited from class com.threerings.nio.conman.ConnectionManager |
|---|
closeConnection, didShutdown, handleAcceptedSocket, handleIterateFailure, iterate, noteWrite, postAsyncClose, processIncomingEvents, register, setShutdownAction, transferAcceptedSocket, willStart, writeMessage |
| Methods inherited from class com.samskivert.util.LoopingThread |
|---|
kick, run, shutdown |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.samskivert.util.Lifecycle.ShutdownComponent |
|---|
shutdown |
| Field Detail |
|---|
@Inject(optional=true) protected Authenticator _author
protected List<ChainedAuthenticator> _authors
protected PrivateKey _privateKey
protected Queue<AuthingConnection> _authq
protected Queue<Tuple<Connection,InetSocketAddress>> _connectq
protected FramingOutputStream _framer
protected ByteArrayOutputStream _flattener
@Inject protected Invoker _authInvoker
@Inject protected ClientManager _clmgr
@Inject protected PresentsDObjectMgr _omgr
protected PresentsConMgrStats _lastStats
protected Queue<Tuple<PresentsConnection,byte[]>> _dataq
protected ByteBuffer _databuf
| Constructor Detail |
|---|
@Inject
public PresentsConnectionManager(Lifecycle cycle,
ReportManager repmgr)
throws IOException
IOException| Method Detail |
|---|
public PresentsConMgrStats getStats()
ConnectionManager
getStats in class ConnectionManager
public void appendReport(StringBuilder report,
long now,
long sinceLast,
boolean reset)
ReportManager.Reporter
appendReport in interface ReportManager.Reporterreport - the string buffer to which the report text should be appended.now - the time at which the report generation began, in epoch millis.sinceLast - number of milliseconds since the last time we generated a report.reset - if true, all accumulating stats should be reset, if false they should be
allowed to continue to accumulate.public void addChainedAuthenticator(ChainedAuthenticator author)
public boolean setPrivateKey(PrivateKey key)
public boolean setPrivateKey(String key)
public PrivateKey getPrivateKey()
protected int handleDatagram(DatagramChannel listener,
long when)
protected void postMessage(PresentsConnection conn,
Message msg)
PresentsConnection.postMessage(com.threerings.presents.net.Message) which happens when forwarding an event to a client
and at the completion of authentication, both of which must happen only on the
distributed object thread.
protected boolean postDatagram(PresentsConnection conn,
Message msg)
throws Exception
postMessage(com.threerings.presents.server.net.PresentsConnection, com.threerings.presents.net.Message); handles posting the message as a datagram.
Exceptionprotected DatagramSequencer createDatagramSequencer()
Connection.
public void openOutgoingConnection(Connection conn,
String hostname,
int port)
throws IOException
conn - the connection to be initialized and opened. Callers may want to provide a
Connection derived class so that they may intercept calldown methods.hostname - the hostname of the server to which to connect.port - the port on which to connect to the server.
IOException - thrown if an error occurs creating our socket. Everything else
happens asynchronously. If the connection attempt fails, the Connection will be notified via
Connection.networkFailure(java.io.IOException).
protected void startOutgoingConnection(Connection conn,
InetSocketAddress addr)
public boolean isRunning()
isRunning in class LoopingThreadprotected void handleIncoming(long iterStamp)
handleIncoming in class ConnectionManager
protected void connectionFailed(Connection conn,
IOException ioe)
ConnectionManager
connectionFailed in class ConnectionManagerprotected void connectionClosed(Connection conn)
ConnectionManager
connectionClosed in class ConnectionManagerprotected void authenticateConnection(AuthingConnection conn)
AuthingConnection itself once it receives its auth request.
protected void handleAcceptedSocket(SocketChannel channel)
handleAcceptedSocket in class ConnectionManagerprotected void processAuthedConnections(long iterStamp)
protected void sendOutgoingMessages(long iterStamp)
ConnectionManager
sendOutgoingMessages in class ConnectionManager
protected boolean writeDatagram(PresentsConnection conn,
byte[] data)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||