Search in sources :

Example 6 with SendChannelEndpoint

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

the class DriverConductor method onAddDestination.

void onAddDestination(final long registrationId, final String destinationChannel, final long correlationId) {
    SendChannelEndpoint sendChannelEndpoint = null;
    for (int i = 0, size = networkPublications.size(); i < size; i++) {
        final NetworkPublication publication = networkPublications.get(i);
        if (registrationId == publication.registrationId()) {
            sendChannelEndpoint = publication.channelEndpoint();
            break;
        }
    }
    if (null == sendChannelEndpoint) {
        throw new ControlProtocolException(UNKNOWN_PUBLICATION, "Unknown publication: " + registrationId);
    }
    sendChannelEndpoint.validateAllowsManualControl();
    final AeronUri aeronUri = AeronUri.parse(destinationChannel);
    final InetSocketAddress dstAddress = UdpChannel.destinationAddress(aeronUri);
    senderProxy.addDestination(sendChannelEndpoint, dstAddress);
    clientProxy.operationSucceeded(correlationId);
}
Also used : SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) AeronUri(io.aeron.driver.uri.AeronUri) InetSocketAddress(java.net.InetSocketAddress) ControlProtocolException(io.aeron.driver.exceptions.ControlProtocolException) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint)

Example 7 with SendChannelEndpoint

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

the class DriverConductor method onAddSpySubscription.

void onAddSpySubscription(final String channel, final int streamId, final long registrationId, final long clientId) {
    final UdpChannel udpChannel = UdpChannel.parse(channel);
    final AeronClient client = getOrAddClient(clientId);
    final SpySubscriptionLink subscriptionLink = new SpySubscriptionLink(registrationId, udpChannel, streamId, client, context.clientLivenessTimeoutNs());
    subscriptionLinks.add(subscriptionLink);
    clientProxy.operationSucceeded(registrationId);
    final SendChannelEndpoint channelEndpoint = sendChannelEndpointByChannelMap.get(udpChannel.canonicalForm());
    for (int i = 0, size = networkPublications.size(); i < size; i++) {
        final NetworkPublication publication = networkPublications.get(i);
        if (streamId == publication.streamId() && channelEndpoint == publication.channelEndpoint() && NetworkPublication.Status.ACTIVE == publication.status()) {
            linkSpy(publication, subscriptionLink);
        }
    }
}
Also used : SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint) UdpChannel(io.aeron.driver.media.UdpChannel) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint)

Aggregations

SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)7 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)5 AeronUri (io.aeron.driver.uri.AeronUri)3 ControlProtocolException (io.aeron.driver.exceptions.ControlProtocolException)2 UdpChannel (io.aeron.driver.media.UdpChannel)2 InetSocketAddress (java.net.InetSocketAddress)2 NewPublicationCmd (io.aeron.driver.cmd.NewPublicationCmd)1 TermAppender (io.aeron.logbuffer.TermAppender)1 AtomicCounter (org.agrona.concurrent.status.AtomicCounter)1 AtomicLongPosition (org.agrona.concurrent.status.AtomicLongPosition)1 Before (org.junit.Before)1