use of io.aeron.exceptions.ControlProtocolException 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);
}
use of io.aeron.exceptions.ControlProtocolException in project aeron by real-logic.
the class DriverConductor method onAddRcvIpcDestination.
void onAddRcvIpcDestination(final long registrationId, final String destinationChannel, final long correlationId) {
final SubscriptionParams params = SubscriptionParams.getSubscriptionParams(ChannelUri.parse(destinationChannel), ctx);
final SubscriptionLink mdsSubscriptionLink = findMdsSubscriptionLink(subscriptionLinks, registrationId);
if (null == mdsSubscriptionLink) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown MDS subscription: " + registrationId);
}
final IpcSubscriptionLink subscriptionLink = new IpcSubscriptionLink(registrationId, mdsSubscriptionLink.streamId(), destinationChannel, mdsSubscriptionLink.aeronClient(), params);
subscriptionLinks.add(subscriptionLink);
clientProxy.operationSucceeded(correlationId);
for (int i = 0, size = ipcPublications.size(); i < size; i++) {
final IpcPublication publication = ipcPublications.get(i);
if (subscriptionLink.matches(publication) && publication.isAcceptingSubscriptions()) {
clientProxy.onAvailableImage(publication.registrationId(), mdsSubscriptionLink.streamId(), publication.sessionId(), registrationId, linkIpcSubscription(publication, subscriptionLink).id(), publication.rawLog().fileName(), CommonContext.IPC_CHANNEL);
}
}
}
use of io.aeron.exceptions.ControlProtocolException 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);
}
use of io.aeron.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onRemoveSendDestination.
void onRemoveSendDestination(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 ChannelUri channelUri = ChannelUri.parse(destinationChannel);
final InetSocketAddress dstAddress = UdpChannel.destinationAddress(channelUri, nameResolver);
senderProxy.removeDestination(sendChannelEndpoint, channelUri, dstAddress);
clientProxy.operationSucceeded(correlationId);
}
use of io.aeron.exceptions.ControlProtocolException in project Aeron by real-logic.
the class DriverConductor method onRemoveSubscription.
void onRemoveSubscription(final long registrationId, final long correlationId) {
boolean isAnySubscriptionFound = false;
for (int lastIndex = subscriptionLinks.size() - 1, i = lastIndex; i >= 0; i--) {
final SubscriptionLink subscription = subscriptionLinks.get(i);
if (subscription.registrationId() == registrationId) {
fastUnorderedRemove(subscriptionLinks, i, lastIndex--);
subscription.close();
cleanupSubscriptionLink(subscription);
isAnySubscriptionFound = true;
}
}
if (!isAnySubscriptionFound) {
throw new ControlProtocolException(UNKNOWN_SUBSCRIPTION, "unknown subscription: " + registrationId);
}
clientProxy.operationSucceeded(correlationId);
}
Aggregations