Search in sources :

Example 1 with IInternodeAuthenticator

use of org.apache.cassandra.auth.IInternodeAuthenticator in project cassandra by apache.

the class InboundConnectionSettings method withDefaults.

// note that connectTo is updated even if specified, in the case of pre40 messaging and using encryption (to update port)
public InboundConnectionSettings withDefaults() {
    // this is for the socket that can be plain, only ssl, or optional plain/ssl
    if (bindAddress.getPort() != DatabaseDescriptor.getStoragePort() && bindAddress.getPort() != DatabaseDescriptor.getSSLStoragePort())
        throw new ConfigurationException(format("Local endpoint port %d doesn't match YAML configured port %d or legacy SSL port %d", bindAddress.getPort(), DatabaseDescriptor.getStoragePort(), DatabaseDescriptor.getSSLStoragePort()));
    IInternodeAuthenticator authenticator = this.authenticator;
    ServerEncryptionOptions encryption = this.encryption;
    Integer socketReceiveBufferSizeInBytes = this.socketReceiveBufferSizeInBytes;
    Integer applicationReceiveQueueCapacityInBytes = this.applicationReceiveQueueCapacityInBytes;
    AcceptVersions acceptMessaging = this.acceptMessaging;
    AcceptVersions acceptStreaming = this.acceptStreaming;
    SocketFactory socketFactory = this.socketFactory;
    Function<InetAddressAndPort, InboundMessageHandlers> handlersFactory = this.handlers;
    if (authenticator == null)
        authenticator = DatabaseDescriptor.getInternodeAuthenticator();
    if (encryption == null)
        encryption = DatabaseDescriptor.getInternodeMessagingEncyptionOptions();
    if (socketReceiveBufferSizeInBytes == null)
        socketReceiveBufferSizeInBytes = DatabaseDescriptor.getInternodeSocketReceiveBufferSizeInBytes();
    if (applicationReceiveQueueCapacityInBytes == null)
        applicationReceiveQueueCapacityInBytes = DatabaseDescriptor.getInternodeApplicationReceiveQueueCapacityInBytes();
    if (acceptMessaging == null)
        acceptMessaging = accept_messaging;
    if (acceptStreaming == null)
        acceptStreaming = accept_streaming;
    if (socketFactory == null)
        socketFactory = instance().socketFactory;
    if (handlersFactory == null)
        handlersFactory = instance()::getInbound;
    Preconditions.checkArgument(socketReceiveBufferSizeInBytes == 0 || socketReceiveBufferSizeInBytes >= 1 << 10, "illegal socket send buffer size: " + socketReceiveBufferSizeInBytes);
    Preconditions.checkArgument(applicationReceiveQueueCapacityInBytes >= 1 << 10, "illegal application receive queue capacity: " + applicationReceiveQueueCapacityInBytes);
    return new InboundConnectionSettings(authenticator, bindAddress, encryption, socketReceiveBufferSizeInBytes, applicationReceiveQueueCapacityInBytes, acceptMessaging, acceptStreaming, socketFactory, handlersFactory);
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) ConfigurationException(org.apache.cassandra.exceptions.ConfigurationException) IInternodeAuthenticator(org.apache.cassandra.auth.IInternodeAuthenticator) ServerEncryptionOptions(org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions)

Aggregations

IInternodeAuthenticator (org.apache.cassandra.auth.IInternodeAuthenticator)1 ServerEncryptionOptions (org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions)1 ConfigurationException (org.apache.cassandra.exceptions.ConfigurationException)1 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)1