Skip to content

Fixed a bug ngx_http_upstream_fair_sched_score function. #2

Merged
merged 1 commit into from Nov 11, 2011

2 participants

@qualtrics

In SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta))) the ~(delta) would dominate the "bitwise or", making the calculated score ignore the number of requests the peer is currently processing.

The fix is to perform a bitwise mask on ~(delta) so it only affect the lower 20bits.
SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta) & SCHED_COUNTER_MAX))

root Fixed a bug ngx_http_upstream_fair_sched_score function.
In SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta))) the ~(delta) would dominate the "bitwise or", making the calculated score ignore the number of requests the peer is currently processing.

The fix is to perform a bitwise mask on ~(delta) so it only affect the lower 20bits.
SCHED_SCORE(nreq,delta) (((nreq) << SCHED_COUNTER_BITS) | (~(delta) & SCHED_COUNTER_MAX))
2b0837a
@gnosek gnosek merged commit 7171df8 into gnosek:master Nov 11, 2011
@gnosek
Owner
gnosek commented Nov 11, 2011

Duh. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.