com.aelitis.azureus.core.clientmessageservice.impl
Class ClientConnection

java.lang.Object
  extended by com.aelitis.azureus.core.clientmessageservice.impl.ClientConnection

public class ClientConnection
extends Object


Constructor Summary
ClientConnection(SocketChannel channel)
          Create a new connection based on an incoming socket.
ClientConnection(TCPTransportImpl transport)
          Create a new connection based on an already-established outgoing socket.
 
Method Summary
 void close(Throwable reason)
           
 void closePending()
          Marks the socket as complete and ready to undergo any close-delay prior to it being closed by the server
 Throwable getClosingReason()
           
 String getDebugString()
           
 long getLastActivityTime()
          Get the last time this connection had read or write activity.
 boolean getLastReadMadeProgress()
           
 boolean getLastWriteMadeProgress()
           
 SocketChannel getSocketChannel()
           
 Object getUserData(Object key)
           
 boolean isClosePending()
           
 Message[] readMessages()
          Get any messages read from the client.
 void resetLastActivityTime()
          Reset the last activity time to the current time.
 void sendMessage(ClientMessage client_msg, Message msg)
           
 void setClosingReason(Throwable r)
           
 void setDebugString(String debug)
           
 void setMaximumMessageSize(int max_bytes)
           
 void setUserData(Object key, Object data)
           
 boolean writeMessages()
          Write any queued messages back to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientConnection

public ClientConnection(SocketChannel channel)
Create a new connection based on an incoming socket.

Parameters:
channel -

ClientConnection

public ClientConnection(TCPTransportImpl transport)
Create a new connection based on an already-established outgoing socket.

Parameters:
transport - parent
Method Detail

readMessages

public Message[] readMessages()
                       throws IOException
Get any messages read from the client.

Returns:
read messages, or null of no new messages were read
Throws:
IOException - on error

getLastReadMadeProgress

public boolean getLastReadMadeProgress()

getLastWriteMadeProgress

public boolean getLastWriteMadeProgress()

sendMessage

public void sendMessage(ClientMessage client_msg,
                        Message msg)

writeMessages

public boolean writeMessages()
                      throws IOException
Write any queued messages back to the client.

Returns:
true if more writing is required, false if all message data has been sent
Throws:
IOException - on error

close

public void close(Throwable reason)

closePending

public void closePending()
Marks the socket as complete and ready to undergo any close-delay prior to it being closed by the server


isClosePending

public boolean isClosePending()

getSocketChannel

public SocketChannel getSocketChannel()

getLastActivityTime

public long getLastActivityTime()
Get the last time this connection had read or write activity.

Returns:
system time of last activity

resetLastActivityTime

public void resetLastActivityTime()
Reset the last activity time to the current time.


setClosingReason

public void setClosingReason(Throwable r)

getClosingReason

public Throwable getClosingReason()

getUserData

public Object getUserData(Object key)

setUserData

public void setUserData(Object key,
                        Object data)

setDebugString

public void setDebugString(String debug)

getDebugString

public String getDebugString()

setMaximumMessageSize

public void setMaximumMessageSize(int max_bytes)