Hi Olivier,

On Mon, Jan 08, 2018 at 04:35:35PM +0100, Olivier Houchard wrote:
> Hi,
> 
> The attached patch attempts to map SRV record weight to haproxy weight 
> correctly,
> SRV weight goes from 0 to 65536 while haproxy uses 0 to 256, so we have to
> divide it by 256, and a SRV weight of 0 doesn't mean the server shouldn't be
> used, so we use a minimum weight of 1.

>From what I'm seeing in the code, it's 0..65535 for the SRV record. And
that allows us to simplify it and use the full range of the weight like
this :

   hap_weight = srv_weight / 256 + 1;

=> 0..255 return 1
   1..511 return 2
   ...
   65280..65535 return 256

What do you think ?

Willy

Reply via email to