Revision: 14886
Author:   adrian.chadd
Date:     Sun Jul 10 01:35:15 2011
Log:      * constify stuff
* Make clientdbCutoffDenied() ipv6-y

http://code.google.com/p/lusca-cache/source/detail?r=14886

Modified:
 /playpen/LUSCA_HEAD_ipv6/src/client_db.c
 /playpen/LUSCA_HEAD_ipv6/src/client_db.h

=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/client_db.c    Tue Jul 13 07:09:46 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/client_db.c    Sun Jul 10 01:35:15 2011
@@ -67,7 +67,7 @@
 static radix_tree_t *client_v6_tree = NULL;
 dlink_list client_list;

-static ClientInfo *clientdbAdd(sqaddr_t *s);
+static ClientInfo *clientdbAdd(const sqaddr_t *s);
 static void clientdbStartGC(void);
 static void clientdbScheduledGC(void *);

@@ -128,7 +128,7 @@
 }

 static ClientInfo *
-clientdbAdd(sqaddr_t *saddr)
+clientdbAdd(const sqaddr_t *saddr)
 {
     radix_node_t *rn;
     prefix_t p;
@@ -169,7 +169,7 @@
 }

 void
-clientdbUpdate6(sqaddr_t *sa, log_type ltype, protocol_t p, squid_off_t size) +clientdbUpdate6(const sqaddr_t *sa, log_type ltype, protocol_t p, squid_off_t size)
 {
     radix_node_t *rn;
     prefix_t pr;
@@ -258,7 +258,7 @@

 #define CUTOFF_SECONDS 3600
 int
-clientdbCutoffDenied(struct in_addr addr)
+clientdbCutoffDenied(const sqaddr_t *addr)
 {
     int NR;
     int ND;
@@ -266,16 +266,13 @@
     ClientInfo *c = NULL;
     prefix_t pr;
     radix_node_t *rn;
-    sqaddr_t sa;
+    char sbuf[MAX_IPSTRLEN];

     if (!Config.onoff.client_db)
        return 0;

-    sqinet_init(&sa);
-    sqinet_set_v4_inaddr(&sa, &addr);
-    clientdb_Init_Prefix(&pr, &sa);
-    rn = clientdb_Radix_Search_Exact(&pr, sqinet_get_family(&sa));
-    sqinet_done(&sa);
+    clientdb_Init_Prefix(&pr, addr);
+    rn = clientdb_Radix_Search_Exact(&pr, sqinet_get_family(addr));

     if (rn)
         c = rn->data;
@@ -297,7 +294,8 @@
     p = 100.0 * ND / NR;
     if (p < 95.0)
        return 0;
- debug(1, 0) ("WARNING: Probable misconfigured neighbor at %s\n", inet_ntoa(addr));
+    (void) sqinet_ntoa(addr, sbuf, MAX_IPSTRLEN, SQADDR_NONE);
+    debug(1, 0) ("WARNING: Probable misconfigured neighbor at %s\n", sbuf);
debug(1, 0) ("WARNING: %d of the last %d ICP replies are DENIED\n", ND, NR); debug(1, 0) ("WARNING: No replies will be sent for the next %d seconds\n",
        CUTOFF_SECONDS);
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/client_db.h    Sun Jul 11 02:15:46 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/client_db.h    Sun Jul 10 01:35:15 2011
@@ -4,8 +4,8 @@
 extern void clientdbInitMem(void);
 extern void clientdbInit(void);
extern void clientdbUpdate(struct in_addr, log_type, protocol_t, squid_off_t); -extern void clientdbUpdate6(sqaddr_t *addr, log_type, protocol_t, squid_off_t);
-extern int clientdbCutoffDenied(struct in_addr);
+extern void clientdbUpdate6(const sqaddr_t *addr, log_type, protocol_t, squid_off_t);
+extern int clientdbCutoffDenied(const sqaddr_t *addr);
 extern void clientdbDump(StoreEntry *);
 extern void clientdbFreeMemory(void);
 extern int clientdbEstablished(struct in_addr, int);

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to