transportChannel.sendResponse(new ElasticsearchSecurityException( "Internal or shard requests not allowed from a non-server node for transport type "+transportChannel.getChannelType())); return; auditLog.logSSLException(request, ex, task.getAction(), task); log.error("No SSL client certificates found for transport type "+transportChannel.getChannelType()+". Search Guard needs the Search Guard SSL plugin to be installed"); transportChannel.sendResponse(ex); return; } else { auditLog.logBadHeaders(request, task.getAction(), task); log.error(exception); transportChannel.sendResponse(exception); return; transportChannel.sendResponse(new ElasticsearchSecurityException("Cannot authenticate "+getThreadContext().getTransient(ConfigConstants.SG_USER))); return; } else { } else { log.error("Request has no proper remote address {}", originalRemoteAddress); transportChannel.sendResponse(new ElasticsearchException("Request has no proper remote address")); return;
@Override public void onFailure(Exception e) { try { channel.sendResponse(e); } catch (Exception inner) { inner.addSuppressed(e); logger.debug("failed to send response on cluster state processed", inner); } } });
@Override public void messageReceived(ValidateJoinRequest request, TransportChannel channel) throws Exception { DiscoveryNode node = localNodeSupplier.get(); assert node != null : "local node is null"; joinValidators.stream().forEach(action -> action.accept(node, request.state)); channel.sendResponse(TransportResponse.Empty.INSTANCE); } }
@Override public void onResponse(Response response) { try { channel.sendResponse(response); } catch (Exception e) { onFailure(e); } }
@Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { try { channel.sendResponse(new MasterPingResponseResponse()); } catch (IOException e) { logger.warn("error while sending ping response", e); } } });
@Override public void onSuccess() { try { channel.sendResponse(TransportResponse.Empty.INSTANCE); } catch (Exception e) { onFailure(e); } }
@Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { try { channel.sendResponse(new AllocateDangledResponse(true)); } catch (IOException e) { logger.warn("failed send response for allocating dangled", e); } } });
@Override public void onFailure(Exception e) { try { channel.sendResponse(e); } catch (Exception e1) { logger.warn(() -> new ParameterizedMessage( "Failed to send error response for action [{}] and request [{}]", actionName, request), e1); } } }
@Override public void handleException(TransportException exp) { try { channel.sendResponse(exp); } catch (IOException e) { logger.debug(() -> new ParameterizedMessage( "failed to send failure {}", extraInfoOnError == null ? "" : "(" + extraInfoOnError + ")"), e); } }
@Override public void messageReceived(TransportRequest.Empty request, TransportChannel channel, Task task) throws Exception { searchService.freeAllScrollContexts(); channel.sendResponse(TransportResponse.Empty.INSTANCE); } });
@Override public void messageReceived(ShardSearchTransportRequest request, TransportChannel channel, Task task) throws Exception { boolean canMatch = searchService.canMatch(request); channel.sendResponse(new CanMatchResponse(canMatch)); } });
@Override public void handleResponse(T response) { try { channel.sendResponse(response); } catch (IOException e) { handleException(new TransportException(e)); } }
public void sendResult(boolean shardActive) { try { channel.sendResponse(new ShardActiveResponse(shardActive, clusterService.localNode())); } catch (IOException e) { logger.error(() -> new ParameterizedMessage("failed send response for shard active while trying to " + "delete shard {} - shard will probably not be removed", request.shardId), e); } catch (EsRejectedExecutionException e) { logger.error(() -> new ParameterizedMessage("failed send response for shard active while trying to " + "delete shard {} - shard will probably not be removed", request.shardId), e); } } }, newState -> {
@Override public void messageReceived(VerifyNodeRepositoryRequest request, TransportChannel channel) throws Exception { DiscoveryNode localNode = clusterService.state().nodes().getLocalNode(); try { doVerify(request.repository, request.verificationToken, localNode); } catch (Exception ex) { logger.warn(() -> new ParameterizedMessage("[{}] failed to verify repository", request.repository), ex); throw ex; } channel.sendResponse(TransportResponse.Empty.INSTANCE); } }
@Override public void messageReceived(SearchFreeContextRequest request, TransportChannel channel, Task task) throws Exception { boolean freed = searchService.freeContext(request.id()); channel.sendResponse(new SearchFreeContextResponse(freed)); } });
@Override public void messageReceived(RecoveryFilesInfoRequest request, TransportChannel channel) throws Exception { try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId() )) { recoveryRef.target().receiveFileInfo(request.phase1FileNames, request.phase1FileSizes, request.phase1ExistingFileNames, request.phase1ExistingFileSizes, request.totalTranslogOps); channel.sendResponse(TransportResponse.Empty.INSTANCE); } } }
@Override public void messageReceived(RecoveryFinalizeRecoveryRequest request, TransportChannel channel) throws Exception { try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId())) { recoveryRef.target().finalizeRecovery(request.globalCheckpoint()); } channel.sendResponse(TransportResponse.Empty.INSTANCE); } }
@Override public void messageReceived(RecoveryWaitForClusterStateRequest request, TransportChannel channel) throws Exception { try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId() )) { recoveryRef.target().ensureClusterStateVersion(request.clusterStateVersion()); } channel.sendResponse(TransportResponse.Empty.INSTANCE); } }
@Override public void messageReceived(final RecoveryHandoffPrimaryContextRequest request, final TransportChannel channel) throws Exception { try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId())) { recoveryRef.target().handoffPrimaryContext(request.primaryContext()); } channel.sendResponse(TransportResponse.Empty.INSTANCE); }
@Override public void messageReceived(RecoveryCleanFilesRequest request, TransportChannel channel) throws Exception { try (RecoveryRef recoveryRef = onGoingRecoveries.getRecoverySafe(request.recoveryId(), request.shardId() )) { recoveryRef.target().cleanFiles(request.totalTranslogOps(), request.sourceMetaSnapshot()); channel.sendResponse(TransportResponse.Empty.INSTANCE); } } }