com.threerings.presents.client
Class ClientCommunicator

java.lang.Object
  extended by com.threerings.presents.client.Communicator
      extended by com.threerings.presents.client.BlockingCommunicator
          extended by com.threerings.presents.client.ClientCommunicator

public class ClientCommunicator
extends BlockingCommunicator

Customizes the blocking communicator with some things that we only do on users' machines (where there's only one client running, not potentially dozens, and where we're not sending high volumes of traffic through the client like we do for inter-server communications). This will go away when we create a special non-blocking communicator for use on the server that integrates with the ClientManager.


Nested Class Summary
protected  class ClientCommunicator.PrefPortInterval
          Used to save our preferred port once we know our connection is not going to be unceremoniously closed by Windows Connection Sharing.
 
Nested classes/interfaces inherited from class com.threerings.presents.client.BlockingCommunicator
BlockingCommunicator.DatagramReader, BlockingCommunicator.DatagramWriter, BlockingCommunicator.Reader, BlockingCommunicator.TerminationMessage, BlockingCommunicator.Writer
 
Field Summary
protected static RuntimeAdjust.BooleanAdjust _logMessages
          Used to control low-level message logging.
protected  ClientCommunicator.PrefPortInterval _prefPortInterval
          We use this interval to record the preferred port if it stays connected long enough.
protected static long PREF_PORT_DELAY
          Time a port must remain connected before we mark it as preferred.
 
Fields inherited from class com.threerings.presents.client.BlockingCommunicator
_bout, _buf, _channel, _datagramChannel, _datagramReader, _datagramWriter, _dataq, _digest, _fin, _fout, _loader, _logonError, _msgq, _oin, _oout, _reader, _secret, _selector, _sequencer, _uout, _writer, DATAGRAM_ATTEMPTS_PER_PORT, DATAGRAM_RESPONSE_WAIT
 
Fields inherited from class com.threerings.presents.client.Communicator
_client, _lastWrite, _omgr
 
Constructor Summary
ClientCommunicator(Client client)
           
 
Method Summary
protected  boolean clearPPI(boolean cancel)
          Cancels our preferred port saving interval.
protected  boolean debugLogMessages()
           
protected  int getPrefPort(String key, int defaultPort)
          Gets our preferred connection port via our preferences mechanism.
protected  void openChannel(InetAddress host)
           
protected  void readerDidExit()
          Callback called by the reader thread when it goes away.
protected  void setPrefPort(String key, int port)
          Sets our preferred connection port via our preferences mechanism.
 
Methods inherited from class com.threerings.presents.client.BlockingCommunicator
closeChannel, closeDatagramChannel, connectionClosed, connectionFailed, datagramReaderDidExit, datagramWriterDidExit, getLastWrite, getTransmitDatagrams, gotBootstrap, logoff, logon, logonSucceeded, postMessage, readDatagram, readFrame, receiveDatagram, receiveMessage, sendDatagram, sendMessage, setClassLoader, throttleOutgoingMessage, writeDatagram, writeMessage, writerDidExit
 
Methods inherited from class com.threerings.presents.client.Communicator
clientCleanup, gotAuthResponse, notifyClientObservers, processMessage, updateWriteStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_prefPortInterval

protected ClientCommunicator.PrefPortInterval _prefPortInterval
We use this interval to record the preferred port if it stays connected long enough.


_logMessages

protected static RuntimeAdjust.BooleanAdjust _logMessages
Used to control low-level message logging.


PREF_PORT_DELAY

protected static long PREF_PORT_DELAY
Time a port must remain connected before we mark it as preferred.

Constructor Detail

ClientCommunicator

public ClientCommunicator(Client client)
Method Detail

setPrefPort

protected void setPrefPort(String key,
                           int port)
Sets our preferred connection port via our preferences mechanism.


getPrefPort

protected int getPrefPort(String key,
                          int defaultPort)
Gets our preferred connection port via our preferences mechanism.


openChannel

protected void openChannel(InetAddress host)
                    throws IOException
Overrides:
openChannel in class BlockingCommunicator
Throws:
IOException

readerDidExit

protected void readerDidExit()
Description copied from class: BlockingCommunicator
Callback called by the reader thread when it goes away.

Overrides:
readerDidExit in class BlockingCommunicator

debugLogMessages

protected boolean debugLogMessages()
Overrides:
debugLogMessages in class BlockingCommunicator

clearPPI

protected boolean clearPPI(boolean cancel)
Cancels our preferred port saving interval. This method is called from the communication reader thread and the interval thread and must thus be synchronized.