What actually happens is that when you change the connection backend_ndx , the C method proxy_connection_set is called ... what this method does is the following:
if you reset backend_ndx = zero --> the connection is returned to the pool
else the method will attempt to find a connection from the connection pool associated with the backend you specified and it sets it as the connection.server
if it finds no connections in the pool it simply sets the backend_ndx & return
Now what your code does is that is changes the backend_ndx inside the read_query method and you maintain no connection pool for your connections at connect_server method
so when the C method is called, it attempts to associate your connection.server with one from the pool but it finds none so it simply changes the backend_ndx and returns
that is why you see the variable changed while the connection.server actually does not
& that is also why changing the backend_ndx inside read_query in rw-splitting & keep-alive work because they maintain a connection pool
-----------
Riham Mohsen, eSpace Technologies
http://www.espace.com.eg/
Edited 3 time(s). Last edit at 05/14/2008 04:54AM by riham mohsen.