Revision: 14880
Author: adrian.chadd
Date: Sat Jul 9 18:52:04 2011
Log: Convert delay pools over to expose an IPv6 API.
Delay pools still isn't yet IPv6-aware; this is just API work.
http://code.google.com/p/lusca-cache/source/detail?r=14880
Modified:
/playpen/LUSCA_HEAD_ipv6/src/client_side.c
/playpen/LUSCA_HEAD_ipv6/src/delay_pools.c
/playpen/LUSCA_HEAD_ipv6/src/protos.h
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/client_side.c Sat Jul 2 20:40:06 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/client_side.c Sat Jul 9 18:52:04 2011
@@ -1929,15 +1929,11 @@
#if DELAY_POOLS
debug(33, 5) ("clientWriteComplete : Normal\n");
if (clientDelayBodyTooLarge(http, http->out.offset - 4096)) {
- struct in_addr a;
-
debug(33, 5) ("clientWriteComplete: we should put this into the pool:
DelayId=%i\n",
http->sc->delay_id);
delayUnregisterDelayIdPtr(&http->sc->delay_id);
- a = sqinet_get_v4_inaddr(&http->conn->peer2, SQADDR_ASSERT_IS_V4);
-#warning delay pools should obviously be mapped to be ipv6 aware at some
point
delaySetStoreClient(http->sc,
delayPoolClient(http->delayAssignedPool,
- (in_addr_t) a.s_addr));
+ &http->conn->peer2));
}
#endif
/* More data will be coming from primary server; register with
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/delay_pools.c Mon Sep 6 22:29:42 2010
+++ /playpen/LUSCA_HEAD_ipv6/src/delay_pools.c Sat Jul 9 18:52:04 2011
@@ -324,7 +324,6 @@
{
request_t *r;
aclCheck_t ch;
- struct in_addr a;
ushort pool;
assert(http);
r = http->request;
@@ -346,24 +345,33 @@
aclCheckFinish(&ch);
return delayId(0, 0);
}
-#warning delay pools needs to be made v6 aware!
- if (sqinet_get_family(&ch.src_address) != AF_INET) {
- aclCheckFinish(&ch);
- return delayId(0, 0);
- }
- a = sqinet_get_v4_inaddr(&ch.src_address, SQADDR_ASSERT_IS_V4);
aclCheckFinish(&ch);
- return delayPoolClient(pool, a.s_addr);
+ return delayPoolClient(pool, &ch.src_address);
}
+/*
+ * Calculate the delay_id for the given pool/client IP.
+ *
+ * This code only knows about IPv4; IPv6 clients are
+ * assigned a delay id of (0, 0).
+ */
delay_id
-delayPoolClient(unsigned short pool, in_addr_t addr)
+delayPoolClient(unsigned short pool, sqaddr_t *sa)
{
int i;
int j;
unsigned int host;
unsigned short position;
unsigned char class, net;
+ struct in_addr a;
+ in_addr_t addr;
+
+ if (sqinet_get_family(sa) != AF_INET)
+ return delayId(0, 0);
+
+ a = sqinet_get_v4_inaddr(sa, SQADDR_ASSERT_IS_V4);
+ addr = a.s_addr;
+
class = Config.Delay.class[pool];
debug(77, 2) ("delayPoolClient: pool %u , class %u\n", pool, class);
if (class == 0)
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/protos.h Sat Jul 9 08:19:48 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/protos.h Sat Jul 9 18:52:04 2011
@@ -902,7 +902,7 @@
extern void delayClearNoDelay(int fd);
extern int delayIsNoDelay(int fd);
extern delay_id delayClient(clientHttpRequest *);
-extern delay_id delayPoolClient(unsigned short pool, in_addr_t client);
+extern delay_id delayPoolClient(unsigned short pool, sqaddr_t *sa);
extern EVH delayPoolsUpdate;
extern int delayBytesWanted(delay_id d, int min, int max);
extern void delayBytesIn(delay_id, int qty);
--
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.