--------------------- PatchSet 10437 Date: 2008/01/27 07:46:09 Author: adri Branch: s27_adri Tag: (none) Log: Don't go through the userhash/sourcehash logic if we don't need to. This saves on an inet_ntoa() call (and thus drops the amount of times we're calling vfprintf() in the main loop); I did similar stuff to userhash just to be consistent. Members: src/peer_sourcehash.c:1.3.48.2->1.3.48.2.4.1 src/peer_userhash.c:1.3->1.3.54.1 Index: squid/src/peer_sourcehash.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_sourcehash.c,v retrieving revision 1.3.48.2 retrieving revision 1.3.48.2.4.1 diff -u -r1.3.48.2 -r1.3.48.2.4.1 --- squid/src/peer_sourcehash.c 30 Nov 2007 16:37:01 -0000 1.3.48.2 +++ squid/src/peer_sourcehash.c 27 Jan 2008 07:46:09 -0000 1.3.48.2.4.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_sourcehash.c,v 1.3.48.2 2007/11/30 16:37:01 adri Exp $ + * $Id: peer_sourcehash.c,v 1.3.48.2.4.1 2008/01/27 07:46:09 adri Exp $ * * DEBUG: section 44 Peer user hash based selection * AUTHOR: Henrik Nordstrom @@ -136,6 +136,9 @@ double high_score = 0; char *key = NULL; + if (n_sourcehash_peers == 0) + return; + key = inet_ntoa(request->client_addr); /* calculate hash key */ Index: squid/src/peer_userhash.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_userhash.c,v retrieving revision 1.3 retrieving revision 1.3.54.1 diff -u -r1.3 -r1.3.54.1 --- squid/src/peer_userhash.c 16 May 2006 05:29:59 -0000 1.3 +++ squid/src/peer_userhash.c 27 Jan 2008 07:46:09 -0000 1.3.54.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_userhash.c,v 1.3 2006/05/16 05:29:59 squidadm Exp $ + * $Id: peer_userhash.c,v 1.3.54.1 2008/01/27 07:46:09 adri Exp $ * * DEBUG: section 44 Peer user hash based selection * AUTHOR: Henrik Nordstrom @@ -136,6 +136,9 @@ double high_score = 0; char *key = NULL; + if (n_userhash_peers == 0) + return NULL; + if (request->auth_user_request) key = authenticateUserRequestUsername(request->auth_user_request); if (!key)