public boolean updateScore()

in tchannel-core/src/main/java/com/uber/tchannel/channels/SubPeer.java [62:89]


    public boolean updateScore(@NotNull OutRequest<?> outRequest) {
        if (outRequest.isUsedPeer(remoteAddress)) {
            // if we have used this peer, it should be given a lower score
            score = SCORE_UNCONNECTED - 0.1;
            return false;
        }

        Peer peer = getPeer();
        boolean flag = false;
        if (peer == null) {
            score = SCORE_UNCONNECTED;
            return flag;
        }

        connection = peer.getConnection(ConnectionState.IDENTIFIED, direction);
        if (!ConnectionState.isConnected(connection)) {
            score = SCORE_UNCONNECTED;
        } else if (!connection.isIdentified()) {
            score = SCORE_CONNECTED;
        } else if (direction != Connection.Direction.NONE && direction != connection.direction) {
            score = SCORE_IDENTIFIED;
        } else {
            flag = true;
            score = SCORE_PREFERRED_DIRECTION;
        }

        return flag;
    }