Hi Robert,

Ok I've made those changes, I now get the following output:

# ./pound -f /etc/pound21-dev.cfg

From Host: 10.190.70.70
pri: 14838
Backend : 2081694976

From Host: 10.190.66.66
pri: 14802
Backend : 2081694976

From Host: 10.190.70.70
pri: 14838
Backend : 2081694976

From Host: 10.190.66.66
pri: 14802
Backend : 2081694976

Hope that helps.

Many thanks

Simon


Robert Segall wrote:
On Fri, 2006-08-18 at 11:53 +0100, Simon Slaytor wrote:
  
Hi Robert,

Ok, I'm no programmer so forgive me if this is wrong.

I've added the following line to the SESS_IP section in svc.c, 
immediately following the pri = 0; line.

printf("Host: %d\n",from_host);
    

from_host is structure. Try printing out addr instead, as it contains
just the information you want. Ideally use inet_ntoa for a
human-readable string.

  
I've also added the following line, immediately before the break; statement.

printf("Backend %d\n",res);
    

res is a pointer to a structure, but the results are good enough.

  
I've then set pound to not run as a daemon.

Ok the the following is the output I get.

When connecting from host 10.190.66.66

Host: 1111670282
Backend -1957071616

When connecting from host 10.190.70.70

Host: 1179041290
Backend -1957071616

As a matter of interest I also added the latter printf statement just 
prior to the break; in the SESS_NONE section.

When running with 'no sessions' I get the following output:

Backend -2029771520   <- client connects to server 1
Backend -2029771008   <-client connects to server 2

The sequence is obviously random.

I hope thats what your after, if not treat me as an idiot and tell me 
what you want.
    

That is almost what we need. If you could change the printing of
from_host as described above it would be very helpful, if you could also
show the value of pri it would be even better. The code would look a bit
like this:

    case SESS_IP:
        /* "sticky" mappings */
fprintf(stderr, "from_host: %s\n", inet_ntoa(&from_host));
        addr = from_host.s_addr;
        pri = 0;
        while(addr) {
            pri = (pri << 3) ^ (addr & 0xff);
            addr = (addr >> 8);
        }
fprintf(stderr, "pri: %d\n", pri & 0xffff);
        res = rand_backend(svc->backends, (pri & 0xffff) %svc->tot_pri);
fprintf(stderr, "backend %ld\n",res);
        break;

I sincerely hope you don't think this is idiot-like treatment - we are
certainly interested in your feedback and we would like to fix the bug
rather than insult people.