public void handleFinished(final Connection connection) throws IOException { SERVER_LOGGER.tracef("Connection finished"); processController.removeManagedConnection(connection); // nothing }
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { ProcessLogger.SERVER_LOGGER.tracef("not trying to respawn process %s.", process.getProcessName()); }
public void handleFailure(final Connection connection, final IOException e) throws IOException { SERVER_LOGGER.tracef(e, "Received failure of connection"); processController.removeManagedConnection(connection); connection.close(); }
public void handleFailure(final Connection connection, final IOException e) throws IOException { SERVER_LOGGER.tracef(e, "Received failure of connection"); processController.removeManagedConnection(connection); connection.close(); }
public void handleShutdown(final Connection connection) throws IOException { SERVER_LOGGER.tracef("Received end-of-stream for connection"); processController.removeManagedConnection(connection); connection.shutdownWrites(); }
public void handleFinished(final Connection connection) throws IOException { SERVER_LOGGER.tracef("Connection finished"); processController.removeManagedConnection(connection); connection.close(); } }
public void handleShutdown(final Connection connection) throws IOException { SERVER_LOGGER.tracef("Received end-of-stream for connection"); processController.removeManagedConnection(connection); connection.shutdownWrites(); }
public MessageHandler handleConnected(final Connection connection) throws IOException { SERVER_LOGGER.tracef("Received connection from %s", connection.getPeerAddress()); return new InitMessageHandler(processController); }
final String processName = readUTFZBytes(dataStream); dataStream.close(); CLIENT_LOGGER.tracef("Received process_added for process %s", processName); messageHandler.handleProcessAdded(client, processName); break; final String processName = readUTFZBytes(dataStream); dataStream.close(); CLIENT_LOGGER.tracef("Received process_started for process %s", processName); messageHandler.handleProcessStarted(client, processName); break; final long uptimeMillis = readLong(dataStream); dataStream.close(); CLIENT_LOGGER.tracef("Received process_stopped for process %s", processName); messageHandler.handleProcessStopped(client, processName, uptimeMillis); break; final String processName = readUTFZBytes(dataStream); dataStream.close(); CLIENT_LOGGER.tracef("Received process_removed for process %s", processName); messageHandler.handleProcessRemoved(client, processName); break; CLIENT_LOGGER.tracef("Received process_inventory"); messageHandler.handleProcessInventory(client, inventory); break; final String processName = readUTFZBytes(dataStream);
operationType = ProcessMessageHandler.OperationType.SEND_STDIN; processName = readUTFZBytes(dataStream); SERVER_LOGGER.tracef("Received send_stdin for process %s", processName); processController.sendStdin(processName, dataStream); } else { SERVER_LOGGER.tracef("Ignoring send_stdin message from untrusted source"); SERVER_LOGGER.tracef("Received add_process for process %s", processName); processController.addProcess(processName, authKey, Arrays.asList(command), env, workingDirectory, false, false); } else { SERVER_LOGGER.tracef("Ignoring add_process message from untrusted source"); processName = readUTFZBytes(dataStream); processController.startProcess(processName); SERVER_LOGGER.tracef("Received start_process for process %s", processName); } else { SERVER_LOGGER.tracef("Ignoring start_process message from untrusted source"); SERVER_LOGGER.tracef("Ignoring stop_process message from untrusted source"); processController.removeProcess(processName); } else { SERVER_LOGGER.tracef("Ignoring remove_process message from untrusted source"); processController.sendInventory(); } else { SERVER_LOGGER.tracef("Ignoring request_process_inventory message from untrusted source"); processController.sendReconnectProcess(processName, hostName, port, managementSubsystemEndpoint, asAuthKey);
public void handleMessage(final Connection connection, final InputStream dataStream) throws IOException { final int cmd = readUnsignedByte(dataStream); if (cmd != Protocol.AUTH) { SERVER_LOGGER.receivedUnknownGreetingCode(Integer.valueOf(cmd), connection.getPeerAddress()); connection.close(); return; } final int version = StreamUtils.readUnsignedByte(dataStream); if (version < 1) { SERVER_LOGGER.receivedInvalidVersion(connection.getPeerAddress()); connection.close(); return; } final byte[] authCode = new byte[16]; StreamUtils.readFully(dataStream, authCode); final ManagedProcess process = processController.getServerByAuthCode(authCode); if (process == null) { SERVER_LOGGER.receivedUnknownCredentials(connection.getPeerAddress()); StreamUtils.safeClose(connection); return; } SERVER_LOGGER.tracef("Received authentic connection from %s", connection.getPeerAddress()); connection.setMessageHandler(new ConnectedMessageHandler(processController, process.isPrivileged())); processController.addManagedConnection(connection); dataStream.close(); // Reset the respawn count for the connecting process process.resetRespawnCount(); }