use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class StaticWindowCongestionControlTest method shouldSetWindowLengthFromTermLength.
@Test
void shouldSetWindowLengthFromTermLength() {
final UdpChannel channelWithWindow = UdpChannel.parse("aeron:udp?endpoint=127.0.0.1:9999|rcv-wnd=8192");
final MediaDriver.Context context = new MediaDriver.Context().initialWindowLength(16536);
final int termLength = 8192;
final StaticWindowCongestionControl staticWindowCongestionControl = new StaticWindowCongestionControl(0, channelWithWindow, 0, 0, termLength, 0, null, null, null, context, null);
assertEquals(termLength / 2, staticWindowCongestionControl.initialWindowLength());
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class TaggedMulticastFlowControlTest method shouldReturnLastWindowWhenUntilReceiversAreInGroupWithNoMinSize.
@Test
void shouldReturnLastWindowWhenUntilReceiversAreInGroupWithNoMinSize() {
final UdpChannel channelGroupSizeThree = UdpChannel.parse("aeron:udp?endpoint=224.20.30.39:24326|interface=localhost|fc=tagged,g:123");
flowControl.initialize(new MediaDriver.Context(), channelGroupSizeThree, 0, 0);
final long groupTag = 123L;
final long senderLimit = 5000L;
final int termOffset0 = 10_000;
final int termOffset1 = 9_999;
assertEquals(termOffset0 + WINDOW_LENGTH, onStatusMessage(flowControl, 0, termOffset0, senderLimit, null));
assertEquals(termOffset1 + WINDOW_LENGTH, onStatusMessage(flowControl, 1, termOffset1, senderLimit, groupTag));
assertEquals(termOffset1 + WINDOW_LENGTH, onStatusMessage(flowControl, 0, termOffset0, senderLimit, null));
}
use of io.aeron.driver.media.UdpChannel in project Aeron by real-logic.
the class UdpChannelTest method shouldHandleLocalhostLookup.
@Test
public void shouldHandleLocalhostLookup() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=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 shouldHandleImpliedLocalAddressAndPortFormat.
@Test
public void shouldHandleImpliedLocalAddressAndPortFormat() {
final UdpChannel udpChannel = UdpChannel.parse("aeron:udp?endpoint=localhost:40124");
assertThat(udpChannel.localData(), is(new InetSocketAddress("0.0.0.0", 0)));
assertThat(udpChannel.localControl(), is(new InetSocketAddress("0.0.0.0", 0)));
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 DriverConductor method onAddNetworkPublication.
void onAddNetworkPublication(final String channel, final int streamId, final long correlationId, final long clientId, final boolean isExclusive) {
final UdpChannel udpChannel = UdpChannel.parse(channel, nameResolver);
final ChannelUri channelUri = udpChannel.channelUri();
final PublicationParams params = getPublicationParams(channelUri, ctx, this, false);
validateEndpointForPublication(udpChannel);
validateMtuForMaxMessage(params, channel);
final SendChannelEndpoint channelEndpoint = getOrCreateSendChannelEndpoint(params, udpChannel, correlationId);
NetworkPublication publication = null;
if (!isExclusive) {
publication = findPublication(networkPublications, streamId, channelEndpoint);
}
boolean isNewPublication = false;
if (null == publication) {
if (params.hasSessionId) {
checkForSessionClash(params.sessionId, streamId, udpChannel.canonicalForm(), channel);
}
publication = newNetworkPublication(correlationId, clientId, streamId, channel, udpChannel, channelEndpoint, params, isExclusive);
isNewPublication = true;
} else {
confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId(), publication.channel(), publication.initialTermId(), publication.startingTermId(), publication.startingTermOffset());
validateSpiesSimulateConnection(params, publication.spiesSimulateConnection(), channel, publication.channel());
}
publicationLinks.add(new PublicationLink(correlationId, getOrAddClient(clientId), publication));
clientProxy.onPublicationReady(correlationId, publication.registrationId(), streamId, publication.sessionId(), publication.rawLog().fileName(), publication.publisherLimitId(), channelEndpoint.statusIndicatorCounterId(), isExclusive);
if (isNewPublication) {
linkSpies(subscriptionLinks, publication);
}
}
Aggregations