Revision: 14875
Author: adrian.chadd
Date: Sat Jul 9 08:19:48 2011
Log: Begin fleshing out a timeout handler; but since I haven't figured
out
how to implement it, ignore it for now.
The main problem is figuring out how to implement a real timeout
queue when the FD doesn't yet exist. The older forward code would
just set a comm timeout handler on the FD before it was used for
connect(), and commResetFD() would not reset that timeout state.
http://code.google.com/p/lusca-cache/source/detail?r=14875
Modified:
/playpen/LUSCA_HEAD_ipv6/src/comm2.c
/playpen/LUSCA_HEAD_ipv6/src/comm2.h
/playpen/LUSCA_HEAD_ipv6/src/forward.c
/playpen/LUSCA_HEAD_ipv6/src/protos.h
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/comm2.c Sat Jul 9 08:09:10 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/comm2.c Sat Jul 9 08:19:48 2011
@@ -79,6 +79,7 @@
cs->comm_flags = flags;
cs->comm_tos = tos;
cs->comm_flags = flags;
+ cs->start_time = cs->timeout = 0;
sqinet_init(&cs->in_addr6);
sqinet_init(&cs->lcl_addr4);
@@ -114,6 +115,12 @@
{
sqinet_copy(&cs->lcl_addr6, lcl);
}
+
+void
+commConnectNewSetTimeout(ConnectStateDataNew *cs, int timeout)
+{
+ cs->timeout = timeout;
+}
/*
* Attempt to connect to host:port.
@@ -126,6 +133,7 @@
void
commConnectStartNewBegin(ConnectStateDataNew *cs)
{
+ cs->start_time = squid_curtime;
/* Begin the host lookup */
ipcache_nbgethostbyname(cs->host, commConnectDnsHandle, cs);
}
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/comm2.h Sat Jul 9 08:09:10 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/comm2.h Sat Jul 9 08:19:48 2011
@@ -8,7 +8,7 @@
void *data;
sqaddr_t in_addr6;
sqaddr_t lcl_addr4; /* outgoing_addr for v4 sockets */
- sqaddr_t lcl_addr6; /* outgoing_addr for v6 sockets */
+ sqaddr_t lcl_addr6; /* outgoing_addr for v6 sockets */
int fd;
int tries;
int addrcount;
@@ -16,6 +16,15 @@
const char *comm_note;
int comm_tos;
int comm_flags;
+
+ /*
+ * Since the forward code had a timeout handler on the
+ * FD which was called regardless of what the current
+ * connection state was (or how many attempst, etc),
+ * we need to replicate that here.
+ */
+ time_t start_time; /* When was the connection started? */
+ int timeout; /* How long is the timeout? */
} ConnectStateDataNew;
extern ConnectStateDataNew *commConnectStartNewSetup(const char *host,
@@ -27,5 +36,7 @@
struct in_addr lcl);
extern void commConnectNewSetupOutgoingV6(ConnectStateDataNew *cs,
sqaddr_t *lcl);
+extern void commConnectNewSetTimeout(ConnectStateDataNew *cs,
+ int timeout);
#endif /* __SQUID_COMM2_H__ */
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/forward.c Sat Jul 9 07:49:03 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/forward.c Sat Jul 9 08:19:48 2011
@@ -527,6 +527,13 @@
aclCheckFinish(&ch);
return r;
}
+
+void
+getOutgoingAddrV6(request_t * request, sqaddr_t *a)
+{
+ sqinet_set_family(a, AF_INET6);
+ sqinet_set_anyaddr(a);
+}
unsigned long
getOutgoingTOS(request_t * request)
@@ -769,6 +776,7 @@
*/
cs = commConnectStartNewSetup(host, port, fwdConnectDone, fwdState,
NULL, 0, tos, url);
+ commConnectNewSetTimeout(cs, ctimeout);
commConnectStartNewBegin(cs);
}
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/protos.h Sat Jul 9 07:28:53 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/protos.h Sat Jul 9 08:19:48 2011
@@ -437,7 +437,8 @@
extern void fwdLogRotate(void);
extern void fwdStatus(FwdState *, http_status);
#endif
-struct in_addr getOutgoingAddr(request_t * request);
+extern struct in_addr getOutgoingAddr(request_t * request);
+extern void getOutgoingAddrV6(request_t * request, sqaddr_t *a);
unsigned long getOutgoingTOS(request_t * request);
extern void urnStart(request_t *, StoreEntry *);
--
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.