Hello Michal,

I found a small bug on resolver.c. In function addrlist_resolve, in source line 318 for version 5.31, there is the instruction:

num+=name2addrlist(addr_list, host->name)

I think It should be:

num = name2addrlist(addr_list, host->name)

I found this because I created a service with three connect lines, like this:

[ldaps]
client=yes
accept=127.0.0.1:7000
connect=10.1.1.1:636
connect=10.2.2.2:636
connect=10.3.2.3:636

And I found this line in the log:
2016.03.15 22:23:34 LOG6[0]: failover: round-robin, starting at entry #6

#6? It should be <= #2 !

I checked the source code, added some s_log instructions and found that the problem. For 3 addresses num variable was set to 6 (1 + 2 + 3) and that was returned by addrlist_resolve.

Hope this helps. And thanks again for your hard work on stunnel.

Best Regards

Jose A. Diaz