Connection register(SocketChannel channel) { if (isFull()) { return null; } Connection connection = new Connection(channel, Time.now()); add(connection); if (LOG.isDebugEnabled()) { LOG.debug("Server connection from " + connection + "; # active connections: " + size() + "; # queued calls: " + callQueue.size()); } return connection; }
if (rpcRequestClass == null) { LOG.warn("Unknown rpc kind " + header.getRpcKind() + " from client " + getHostAddress()); final String err = "Unknown rpc kind in rpc header" + header.getRpcKind(); } catch (Throwable t) { // includes runtime exception from newInstance LOG.warn("Unable to read call parameters for client " + getHostAddress() + "on connection protocol " + this.protocolName + " for rpcKind " + header.getRpcKind(), t); String err = "IPC server unable to read call parameters: "+ t.getMessage(); RpcErrorCodeProto.ERROR_RPC_SERVER, ioe); incRpcCount(); // Increment the rpc count
return; c.setLastContact(Time.now()); count = c.readAndProcess(); } catch (InterruptedException ieo) { LOG.info(Thread.currentThread().getName() + ": readAndProcess caught InterruptedException", ieo); if (count < 0 || c.shouldClose()) { closeConnection(c); c = null; c.setLastContact(Time.now());
public int readAndProcess() throws IOException, InterruptedException { while (!shouldClose()) { // stop if a fatal response has been sent. this.setServiceClass(serviceClass); dataLengthBuffer.flip(); setupHttpRequestOnIpcPortResponse(); return -1; " got version " + version + " expected version " + CURRENT_VERSION); setupBadVersionResponse(version); return -1; authProtocol = initializeAuthContext(connectionHeaderBuf.get(2)); dataLengthBuffer.flip(); dataLength = dataLengthBuffer.getInt(); checkDataLength(dataLength); data = ByteBuffer.allocate(dataLength); processOneRpc(requestData); if (!isHeaderRead || (isSSLEnabled && sslUnwrappedBuffer.position() != 0)) {
incRpcCount(); // Increment the rpc count data.flip(); if (headerRead) { processData(); data = null; return count; } else { processHeader(); headerRead = true; data = null;
this.setServiceClass(connectionHeaderBuf.get(1)); dataLengthBuffer.flip(); setupHttpRequestOnIpcPortResponse(); return -1; " got version " + version + " expected version " + CURRENT_VERSION); setupBadVersionResponse(version); return -1; authProtocol = initializeAuthContext(connectionHeaderBuf.get(2)); dataLengthBuffer.flip(); dataLength = dataLengthBuffer.getInt(); checkDataLength(dataLength); data = ByteBuffer.allocate(dataLength); data.flip(); boolean isHeaderRead = connectionContextRead; processOneRpc(data.array()); data = null; if (!isHeaderRead) {
if (rpcRequestClass == null) { LOG.warn("Unknown rpc kind " + header.getRpcKind() + " from client " + getHostAddress()); final String err = "Unknown rpc kind in rpc header" + header.getRpcKind(); } catch (Throwable t) { // includes runtime exception from newInstance LOG.warn("Unable to read call parameters for client " + getHostAddress() + "on connection protocol " + this.protocolName + " for rpcKind " + header.getRpcKind(), t); String err = "IPC server unable to read call parameters: "+ t.getMessage(); RpcErrorCodeProto.ERROR_RPC_SERVER, ioe); incRpcCount(); // Increment the rpc count
incRpcCount(); // Increment the rpc count data.flip(); if (headerRead) { processData(); data = null; return count; } else { processHeader(); headerRead = true; data = null;
this.setServiceClass(connectionHeaderBuf.get(1)); dataLengthBuffer.flip(); setupHttpRequestOnIpcPortResponse(); return -1; " got version " + version + " expected version " + CURRENT_VERSION); setupBadVersionResponse(version); return -1; authProtocol = initializeAuthContext(connectionHeaderBuf.get(2)); dataLengthBuffer.flip(); dataLength = dataLengthBuffer.getInt(); checkDataLength(dataLength); data = ByteBuffer.allocate(dataLength); data.flip(); boolean isHeaderRead = connectionContextRead; processOneRpc(data.array()); data = null; if (!isHeaderRead) {
this.setServiceClass(connectionHeaderBuf.get(1)); dataLengthBuffer.flip(); setupHttpRequestOnIpcPortResponse(); return -1; " got version " + version + " expected version " + CURRENT_VERSION); setupBadVersionResponse(version); return -1; authProtocol = initializeAuthContext(connectionHeaderBuf.get(2)); dataLengthBuffer.flip(); dataLength = dataLengthBuffer.getInt(); checkDataLength(dataLength); data = ByteBuffer.allocate(dataLength); data.flip(); boolean isHeaderRead = connectionContextRead; processOneRpc(data.array()); data = null; if (!isHeaderRead) {
"Client already attempted negotiation"); saslResponse = buildSaslNegotiateResponse(); switchToSimple(); + " Available:" + enabledAuthMethods); saslResponse = buildSaslNegotiateResponse(); break; switchToSimple(); saslResponse = null; break; saslServer = createSaslServer(authMethod); saslResponse = processSaslToken(saslMessage); break; saslResponse = processSaslToken(saslMessage); break;
boolean crlValidationPassed = false; if (isSSLEnabled) { if (!c.doHandshake()) { LOG.error("TLS handshake for " + c.getHostAddress() + " failed"); connectionManager.close(c); } else { handshakeDone = true; LOG.debug("TLS handshake for " + c.getHostAddress() + " succeed"); if (crlValidator != null) { LOG.debug("Checking certificate validity against CRL");
try { try { saslResponse = processSaslMessage(saslMessage); } catch (IOException e) { rpcMetrics.incrAuthenticationFailures(); IOException tce = (IOException) getCauseForInvalidToken(e); AUDITLOG.warn(AUTH_FAILED_FOR + this.toString() + ":" + attemptingUser + " (" + e.getLocalizedMessage() + ") with true cause: (" + tce.getLocalizedMessage() + ")"); + saslServer.getNegotiatedProperty(Sasl.QOP)); user = getAuthorizedUgi(saslServer.getAuthorizationID()); if (LOG.isDebugEnabled()) { LOG.debug("SASL server successfully authenticated client: " + user); doSaslReply(saslResponse); disposeSasl();
"Client already attempted negotiation"); saslResponse = buildSaslNegotiateResponse(); switchToSimple(); + " Available:" + enabledAuthMethods); saslResponse = buildSaslNegotiateResponse(); break; switchToSimple(); saslResponse = null; break; saslServer = createSaslServer(authMethod); saslResponse = processSaslToken(saslMessage); break; saslResponse = processSaslToken(saslMessage); break;
if (rpcRequestClass == null) { LOG.warn("Unknown rpc kind " + header.getRpcKind() + " from client " + getHostAddress()); final String err = "Unknown rpc kind in rpc header" + header.getRpcKind(); } catch (Throwable t) { // includes runtime exception from newInstance LOG.warn("Unable to read call parameters for client " + getHostAddress() + "on connection protocol " + this.protocolName + " for rpcKind " + header.getRpcKind(), t); String err = "IPC server unable to read call parameters: "+ t.getMessage(); queueRequestOrAskClientToBackOff(call); } else { incRpcCount(); // Increment the rpc count
if (rpcRequestClass == null) { LOG.warn("Unknown rpc kind " + header.getRpcKind() + " from client " + getHostAddress()); final String err = "Unknown rpc kind in rpc header" + header.getRpcKind(); } catch (Throwable t) { // includes runtime exception from newInstance LOG.warn("Unable to read call parameters for client " + getHostAddress() + "on connection protocol " + this.protocolName + " for rpcKind " + header.getRpcKind(), t); String err = "IPC server unable to read call parameters: "+ t.getMessage(); queueRequestOrAskClientToBackOff(call); } else { incRpcCount(); // Increment the rpc count
"Client already attempted negotiation"); saslResponse = buildSaslNegotiateResponse(); switchToSimple(); + " Available:" + enabledAuthMethods); saslResponse = buildSaslNegotiateResponse(); break; switchToSimple(); saslResponse = null; break; saslServer = createSaslServer(authMethod); saslResponse = processSaslToken(saslMessage); break; saslResponse = processSaslToken(saslMessage); break;
"Connection context already processed"); connectionContext = decodeProtobufFromStream( IpcConnectionContextProto.newBuilder(), dis); protocolName = connectionContext.hasProtocol() ? connectionContext authorizeConnection();
"Connection context already processed"); connectionContext = decodeProtobufFromStream( IpcConnectionContextProto.newBuilder(), dis); protocolName = connectionContext.hasProtocol() ? connectionContext authorizeConnection();
"Connection context already processed"); connectionContext = getMessage(IpcConnectionContextProto.getDefaultInstance(), buffer); protocolName = connectionContext.hasProtocol() ? connectionContext .getProtocol() : null; if (authProtocol == AuthProtocol.NONE) { user = protocolUser; authenticateSSLConnection(protocolUser); } else { authorizeConnection();