Methods Summary |
---|
public void | close()
NetworkManager.getSingleton().stopTransferProcessing( this );
closed = true;
if ( connection_attempt != null ){
connection_attempt.abandon();
}
if ( transport != null ){
transport.close( "Tidy close" );
}
incoming_message_queue.destroy();
outgoing_message_queue.destroy();
is_connected = false;
|
public void | connect(ConnectionListener listener)
connect( null, listener );
|
public void | connect(java.nio.ByteBuffer initial_outbound_data, ConnectionListener listener)
this.connection_listener = listener;
if( is_connected ){
connection_listener.connectStarted();
connection_listener.connectSuccess( initial_outbound_data );
return;
}
if ( connection_attempt != null ){
Debug.out( "Connection attempt already active" );
listener.connectFailure( new Throwable( "Connection attempt already active" ));
return;
}
connection_attempt =
connection_endpoint.connectOutbound(
connect_with_crypto,
allow_fallback,
shared_secrets,
initial_outbound_data,
new Transport.ConnectListener() {
public void connectAttemptStarted() {
connection_listener.connectStarted();
}
public void connectSuccess( Transport _transport, ByteBuffer remaining_initial_data ) {
is_connected = true;
transport = _transport;
outgoing_message_queue.setTransport( transport );
connection_listener.connectSuccess( remaining_initial_data );
connection_attempt = null;
}
public void connectFailure( Throwable failure_msg ) {
is_connected = false;
connection_listener.connectFailure( failure_msg );
}
});
if ( closed ){
ConnectionAttempt ca = connection_attempt;
if ( ca != null ){
ca.abandon();
}
}
|
public Transport | detachTransport()
Transport t = transport;
transport = new bogusTransport( transport );
close();
return( t );
|
public void | enableEnhancedMessageProcessing(boolean enable)
if( enable ) {
NetworkManager.getSingleton().upgradeTransferProcessing( this );
}
else {
NetworkManager.getSingleton().downgradeTransferProcessing( this );
}
|
public ConnectionEndpoint | getEndpoint()
return( connection_endpoint );
|
public IncomingMessageQueue | getIncomingMessageQueue() return incoming_message_queue;
|
public int | getMssSize()
if ( transport == null ){
return( NetworkManager.getMinMssSize());
}else{
return( transport.getMssSize());
}
|
public OutgoingMessageQueue | getOutgoingMessageQueue() return outgoing_message_queue;
|
public java.lang.String | getString()
return( "tran=" + (transport==null?"null":transport.getDescription()+",w_ready=" + transport.isReadyForWrite(null)+",r_ready=" + transport.isReadyForRead( null ))+ ",in=" + incoming_message_queue.getPercentDoneOfCurrentMessage() +
",out=" + outgoing_message_queue.getTotalSize() + ",owner=" + (connection_listener==null?"null":connection_listener.getDescription()));
|
public Transport | getTransport() return transport;
|
public TransportBase | getTransportBase() return transport;
|
public boolean | isConnected()
return is_connected;
|
public boolean | isLANLocal()
if ( is_lan_local == AddressUtils.LAN_LOCAL_MAYBE ){
is_lan_local = AddressUtils.isLANLocalAddress( connection_endpoint.getNotionalAddress());
}
return( is_lan_local == AddressUtils.LAN_LOCAL_YES );
|
public void | notifyOfException(java.lang.Throwable error)
if( connection_listener != null ) {
connection_listener.exceptionThrown( error );
}
else {
Debug.out( "notifyOfException():: connection_listener == null for exception: " +error.getMessage() );
}
|
public void | startMessageProcessing()
NetworkManager.getSingleton().startTransferProcessing( this );
|
public java.lang.String | toString()
return( transport==null?connection_endpoint.getDescription():transport.getDescription() );
|