Mailing List Archive

[mod_backhand-users] New Candidacy function: byChooseN
I've written a trivial new candidacy function in the spirit of
byLogWindow. Whereas byLogWindow eliminates all but the first log
base 2 of the n servers passed in, byChooseN eliminates all but the
first ARG of the n servers passed in. For instance:

BackhandFromSO libexec/byChooseN.so byChooseN 5

Will winnow the list down to 5 servers, and

BackhandFromSO libexec/byChooseN.so byChooseN 3

Will leave only 3 servers in the list.

Checks have been put into place so it never increases the size of the
candidacy list. Feel free to distribute at will.

--------------- BEGIN byChooseN.c ----------
#include "httpd.h"
#include "http_log.h"
#include "mod_backhand.h"
int byChooseN(request_rec *r, int *servers, int *n, char *arg) {
int mycount;
int oldsize=*n;
if(arg) mycount = atoi(arg);
else mycount = oldsize;
if(oldsize < mycount)
mycount = oldsize;
*n = mycount;
return mycount;
}
--------------- END byChooseN.c ----------

Questions, comments?

-Blake