GenericMessageEndpointImpl endpoint = new GenericMessageEndpointImpl( originator );
endpoint.addUDP( originator );
GenericMessageHandler handler = message_manager.getHandler( msg_id );
if ( handler == null ){
Debug.out( "No message handler registered for '" + msg_id + "'" );
return( null );
}
try{
Long con_id;
synchronized( remote_connections ){
if ( remote_connections.size() >= MAX_REMOTE_CONNECTIONS ){
Debug.out( "Maximum remote connections exceeded - request from " + originator + " denied [" + getRemoteConnectionStatus() + "]" );
return( null );
}
int num_from_this_ip = 0;
Iterator it = remote_connections.values().iterator();
while( it.hasNext()){
GenericMessageConnectionIndirect con = (GenericMessageConnectionIndirect)it.next();
if ( con.getEndpoint().getNotionalAddress().getAddress().equals( originator.getAddress())){
num_from_this_ip++;
}
}
if ( num_from_this_ip >= MAX_REMOTE_CONNECTIONS_PER_IP ){
Debug.out( "Maximum remote connections per-ip exceeded - request from " + originator + " denied [" + getRemoteConnectionStatus() + "]" );
return( null );
}
con_id = new Long( connection_id_next++ );
}
GenericMessageConnectionIndirect indirect_connection =
new GenericMessageConnectionIndirect(
message_manager, msg_id, msg_desc, endpoint, con_id.longValue());
GenericMessageConnectionImpl new_connection = new GenericMessageConnectionImpl( message_manager, indirect_connection );
if ( handler.accept( new_connection )){
new_connection.accepted();
synchronized( remote_connections ){