Search in sources :

Example 1 with ReceiveDestinationTransport

use of io.aeron.driver.media.ReceiveDestinationTransport in project Aeron by real-logic.

the class DriverConductor method onAddRcvNetworkDestination.

void onAddRcvNetworkDestination(final long registrationId, final String destinationChannel, final long correlationId) {
    final UdpChannel udpChannel = UdpChannel.parse(destinationChannel, nameResolver, true);
    validateDestinationUri(udpChannel.channelUri(), destinationChannel);
    final SubscriptionLink mdsSubscriptionLink = findMdsSubscriptionLink(subscriptionLinks, registrationId);
    if (null == mdsSubscriptionLink) {
        throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown MDS subscription: " + registrationId);
    }
    final ReceiveChannelEndpoint receiveChannelEndpoint = mdsSubscriptionLink.channelEndpoint();
    final AtomicCounter localSocketAddressIndicator = ReceiveLocalSocketAddress.allocate(tempBuffer, countersManager, registrationId, receiveChannelEndpoint.statusIndicatorCounter().id());
    final ReceiveDestinationTransport transport = new ReceiveDestinationTransport(udpChannel, ctx, localSocketAddressIndicator, receiveChannelEndpoint);
    receiverProxy.addDestination(receiveChannelEndpoint, transport);
    clientProxy.operationSucceeded(correlationId);
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) ReceiveDestinationTransport(io.aeron.driver.media.ReceiveDestinationTransport) ControlProtocolException(io.aeron.exceptions.ControlProtocolException) AtomicCounter(org.agrona.concurrent.status.AtomicCounter) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint)

Example 2 with ReceiveDestinationTransport

use of io.aeron.driver.media.ReceiveDestinationTransport in project Aeron by real-logic.

the class Receiver method onRemoveDestination.

void onRemoveDestination(final ReceiveChannelEndpoint channelEndpoint, final UdpChannel udpChannel) {
    final int transportIndex = channelEndpoint.destination(udpChannel);
    if (ArrayUtil.UNKNOWN_INDEX != transportIndex) {
        final ReceiveDestinationTransport transport = channelEndpoint.destination(transportIndex);
        dataTransportPoller.cancelRead(channelEndpoint, transport);
        channelEndpoint.removeDestination(transportIndex);
        CloseHelper.close(transport);
        dataTransportPoller.selectNowWithoutProcessing();
        for (final PublicationImage image : publicationImages) {
            if (channelEndpoint == image.channelEndpoint()) {
                image.removeDestination(transportIndex);
            }
        }
    }
}
Also used : ReceiveDestinationTransport(io.aeron.driver.media.ReceiveDestinationTransport) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint)

Example 3 with ReceiveDestinationTransport

use of io.aeron.driver.media.ReceiveDestinationTransport in project aeron by real-logic.

the class DriverConductor method onAddRcvNetworkDestination.

void onAddRcvNetworkDestination(final long registrationId, final String destinationChannel, final long correlationId) {
    final UdpChannel udpChannel = UdpChannel.parse(destinationChannel, nameResolver, true);
    validateDestinationUri(udpChannel.channelUri(), destinationChannel);
    final SubscriptionLink mdsSubscriptionLink = findMdsSubscriptionLink(subscriptionLinks, registrationId);
    if (null == mdsSubscriptionLink) {
        throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown MDS subscription: " + registrationId);
    }
    final ReceiveChannelEndpoint receiveChannelEndpoint = mdsSubscriptionLink.channelEndpoint();
    final AtomicCounter localSocketAddressIndicator = ReceiveLocalSocketAddress.allocate(tempBuffer, countersManager, registrationId, receiveChannelEndpoint.statusIndicatorCounter().id());
    final ReceiveDestinationTransport transport = new ReceiveDestinationTransport(udpChannel, ctx, localSocketAddressIndicator, receiveChannelEndpoint);
    receiverProxy.addDestination(receiveChannelEndpoint, transport);
    clientProxy.operationSucceeded(correlationId);
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) ReceiveDestinationTransport(io.aeron.driver.media.ReceiveDestinationTransport) ControlProtocolException(io.aeron.exceptions.ControlProtocolException) AtomicCounter(org.agrona.concurrent.status.AtomicCounter) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint)

Example 4 with ReceiveDestinationTransport

use of io.aeron.driver.media.ReceiveDestinationTransport in project aeron by real-logic.

the class Receiver method onRemoveDestination.

void onRemoveDestination(final ReceiveChannelEndpoint channelEndpoint, final UdpChannel udpChannel) {
    final int transportIndex = channelEndpoint.destination(udpChannel);
    if (ArrayUtil.UNKNOWN_INDEX != transportIndex) {
        final ReceiveDestinationTransport transport = channelEndpoint.destination(transportIndex);
        dataTransportPoller.cancelRead(channelEndpoint, transport);
        channelEndpoint.removeDestination(transportIndex);
        CloseHelper.close(transport);
        dataTransportPoller.selectNowWithoutProcessing();
        for (final PublicationImage image : publicationImages) {
            if (channelEndpoint == image.channelEndpoint()) {
                image.removeDestination(transportIndex);
            }
        }
    }
}
Also used : ReceiveDestinationTransport(io.aeron.driver.media.ReceiveDestinationTransport) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint)

Aggregations

ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)4 ReceiveDestinationTransport (io.aeron.driver.media.ReceiveDestinationTransport)4 UdpChannel (io.aeron.driver.media.UdpChannel)2 ControlProtocolException (io.aeron.exceptions.ControlProtocolException)2 AtomicCounter (org.agrona.concurrent.status.AtomicCounter)2