use of io.aeron.driver.media.UdpChannel 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);
}
}
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri.
@Theory
public void shouldHandleExplicitLocalAddressAndPortFormatWithAeronUri(@Values({ "endpoint" }) final String endpointKey, @Values({ "interface" }) final String interfaceKey) throws Exception {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124", interfaceKey, "localhost:40123"));
assertThat(udpChannel.localData(), is(new InetSocketAddress("localhost", 40123)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("localhost", 40123)));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("localhost", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("localhost", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleLocalhostLookupWithAeronUri.
@Theory
public void shouldHandleLocalhostLookupWithAeronUri(@Values({ "endpoint" }) final String endpointKey) throws Exception {
final UdpChannel udpChannel = UdpChannel.parse(uri(endpointKey, "localhost:40124"));
assertThat(udpChannel.remoteData(), is(new InetSocketAddress("127.0.0.1", 40124)));
assertThat(udpChannel.remoteControl(), is(new InetSocketAddress("127.0.0.1", 40124)));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleCanonicalFormForUnicastCorrectly.
@Test
public void shouldHandleCanonicalFormForUnicastCorrectly() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocal = UdpChannel.parse("aeron:udp?interface=127.0.0.1|endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocalPort = UdpChannel.parse("aeron:udp?interface=127.0.0.1:40455|endpoint=192.168.0.1:40456");
final UdpChannel udpChannelLocalhost = UdpChannel.parse("aeron:udp?interface=localhost|endpoint=localhost:40456");
assertThat(udpChannel.canonicalForm(), is("UDP-00000000-0-c0a80001-40456"));
assertThat(udpChannelLocal.canonicalForm(), is("UDP-7f000001-0-c0a80001-40456"));
assertThat(udpChannelLocalPort.canonicalForm(), is("UDP-7f000001-40455-c0a80001-40456"));
assertThat(udpChannelLocalhost.canonicalForm(), is("UDP-7f000001-0-7f000001-40456"));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldGetProtocolFamilyForIpV6WithoutLocalSpecified.
@Test
public void shouldGetProtocolFamilyForIpV6WithoutLocalSpecified() throws Exception {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=[::1]:12345");
assertThat(udpChannel.protocolFamily(), is((ProtocolFamily) StandardProtocolFamily.INET6));
}
Aggregations