public void start() { synchronized (lock) { if (state != State.DOWN) { log.debugf("Attempted to start already-running process '%s'", processName); return; } resetRespawnCount(); doStart(false); } }
public void start() { synchronized (lock) { if (state != State.DOWN) { log.debugf("Attempted to start already-running process '%s'", processName); return; } resetRespawnCount(); doStart(false); } }
public void start() { synchronized (lock) { if (state != State.DOWN) { log.debugf("Attempted to start already-running process '%s'", processName); return; } resetRespawnCount(); doStart(false); } }
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(); }
public void handleMessage(final Connection connection, final InputStream dataStream) throws IOException { final int cmd = readUnsignedByte(dataStream); if (cmd != Protocol.AUTH) { ProcessLogger.SERVER_LOGGER.receivedUnknownGreetingCode(Integer.valueOf(cmd), connection.getPeerAddress()); connection.close(); return; } final int version = StreamUtils.readUnsignedByte(dataStream); if (version < 1) { ProcessLogger.SERVER_LOGGER.receivedInvalidVersion(connection.getPeerAddress()); connection.close(); return; } final byte[] authCode = new byte[ProcessController.AUTH_BYTES_ENCODED_LENGTH]; StreamUtils.readFully(dataStream, authCode); final ManagedProcess process = processController.getServerByAuthCode(authCode); if (process == null) { ProcessLogger.SERVER_LOGGER.receivedUnknownCredentials(connection.getPeerAddress()); StreamUtils.safeClose(connection); return; } ProcessLogger.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(); }
public void handleMessage(final Connection connection, final InputStream dataStream) throws IOException { final int cmd = readUnsignedByte(dataStream); if (cmd != Protocol.AUTH) { ProcessLogger.SERVER_LOGGER.receivedUnknownGreetingCode(Integer.valueOf(cmd), connection.getPeerAddress()); connection.close(); return; } final int version = StreamUtils.readUnsignedByte(dataStream); if (version < 1) { ProcessLogger.SERVER_LOGGER.receivedInvalidVersion(connection.getPeerAddress()); connection.close(); return; } final byte[] authCode = new byte[ProcessController.AUTH_BYTES_ENCODED_LENGTH]; StreamUtils.readFully(dataStream, authCode); final ManagedProcess process = processController.getServerByAuthCode(authCode); if (process == null) { ProcessLogger.SERVER_LOGGER.receivedUnknownCredentials(connection.getPeerAddress()); StreamUtils.safeClose(connection); return; } ProcessLogger.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(); }