Hello
This is my first post in this ML. I'm new to the code of Squid, so I'm yet
reading the code and developer resources in the web
(http://wiki.squid-cache.org/DeveloperResources).
What I want to do is allowing persistent connections just whenever the
tcp_outgoing_address fit with a existing connection.
The reason is simple: we use the tcp_outgoing_address to identify set of
clients and give them different bandwidth with a Packeteer PacketShaper.
I have look the code, and I think I have found some interesting functions.
Basically, pconnPush that seems to put an idle connection in a hashtable. I
don't understand the function as it calls a lot of other functions. It seems
that an open connection is inserted in the hashtable when idle.
It's called from httpReadReply function this way:
---------------------------------------
if (request->flags.pinned) {
pinned = 1;
} else if (request->flags.connection_auth &&
request->flags.auth_sent) {
pinned = 1;
}
if (orig_request->pinned_connection && pinned) {
clientPinConnection(orig_request->pinned_connection,
fd, orig_request, httpState->peer, request->flag
s.connection_auth);
} else if (httpState->peer) {
if (httpState->peer->options.originserver)
pconnPush(fd, httpState->peer->name,
httpState->peer->http_port, httpState->orig_request->host, c
lient_addr, client_port);
else
pconnPush(fd, httpState->peer->name,
httpState->peer->http_port, NULL, client_addr, client_port);
} else {
pconnPush(fd, request->host, request->port, NULL,
client_addr, client_port);
}
---------------------------------------
Ok, that seems right for me. What I can't find is the code deciding if we have
to reuse a pconn or to create a new one.
I thought it should be "near" the outgoingAddress, indeed in the
fwdConnectStart(void *data) function... Finally I got this call:
if (fd == -1)
fd = pconnPop(name, port, domain, NULL, 0);
What should be the effect of changing the NULL by
&fwdState->request->client_addr ?
Then I'll be assuming that each client has different tcp_outgoing_address
(which is still more conservative than my original idea), but I'll be gaining
persistent connection at least client-based.
Is that what I need? I'm not sure what's happening with the PConnKey having
the client_address... should I modify the call to pconnPush too?
-----------
} else if (httpState->peer) {
if (httpState->peer->options.originserver)
pconnPush(fd, httpState->peer->name,
httpState->peer->http_port, httpState->orig_request->host, client_addr,
client_port);
else
pconnPush(fd, httpState->peer->name,
httpState->peer->http_port, NULL, client_addr, client_port);
} else {
pconnPush(fd, request->host, request->port, NULL,
client_addr, client_port);
}
------------
I don't know what's checking in each if?... originserver seems to be related
to an option in cache_peer. I think I should modify the last call, with
pconnPush(fd, request->host, request->port,
httpState->orig_request->host, client_addr, client_port);
Is that correct? am I missing something?
Thanks you,
Francisco Gimeno
This archive was generated by hypermail pre-2.1.9 : Thu Mar 01 2007 - 12:00:02 MST