Revision: 14873
Author:   adrian.chadd
Date:     Sat Jul  9 07:49:03 2011
Log: Separate out the "setup" and "begin" phases of the comm connect framework
(v2.)


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

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/comm2.c        Sat Jul  9 07:38:30 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/comm2.c        Sat Jul  9 07:49:03 2011
@@ -51,6 +51,8 @@
 #include <netinet/tcp.h>
 #endif

+#include "comm2.h"
+
 static PF commConnectFree;
 static PF commConnectHandle;
 static IPH commConnectDnsHandle;
@@ -59,15 +61,10 @@
 CBDATA_TYPE(ConnectStateDataNew);

 /*
- * Attempt to connect to host:port.
- * addr6 can specify a fixed v4 or v6 address; or NULL for host lookup.
- *
- * flags: additional comm flags
- * tos: TOS for newly created sockets
- * note: note for newly created sockets
+ * Setup a comm connect (new) structure for a future "start" call.
  */
-void
-commConnectStartNew(const char *host, u_short port, CNCB * callback,
+ConnectStateDataNew *
+commConnectStartNewSetup(const char *host, u_short port, CNCB *callback,
     void *data, sqaddr_t *addr6, int flags, int tos, const char *note)
 {
     ConnectStateDataNew *cs;
@@ -95,8 +92,23 @@
     }
     cbdataLock(cs->data);

+    return cs;
+}
+
+
+/*
+ * Attempt to connect to host:port.
+ * addr6 can specify a fixed v4 or v6 address; or NULL for host lookup.
+ *
+ * flags: additional comm flags
+ * tos: TOS for newly created sockets
+ * note: note for newly created sockets
+ */
+void
+commConnectStartNewBegin(ConnectStateDataNew *cs)
+{
     /* Begin the host lookup */
-    ipcache_nbgethostbyname(host, commConnectDnsHandle, cs);
+    ipcache_nbgethostbyname(cs->host, commConnectDnsHandle, cs);
 }


=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/comm2.h        Sat Jul  9 07:28:53 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/comm2.h        Sat Jul  9 07:49:03 2011
@@ -16,8 +16,10 @@
     int comm_flags;
 } ConnectStateDataNew;

-extern void
-commConnectStartNew(const char *host, u_short port, CNCB * callback,
-    void *data, sqaddr_t *addr6, int flags, int tos, const char *note);
+extern ConnectStateDataNew *commConnectStartNewSetup(const char *host,
+  u_short port, CNCB * callback, void *data, sqaddr_t *addr6, int flags,
+  int tos, const char *note);
+
+extern void commConnectStartNewBegin(ConnectStateDataNew *cs);

 #endif /* __SQUID_COMM2_H__ */
=======================================
--- /playpen/LUSCA_HEAD_ipv6/src/forward.c      Sat Jul  9 07:28:53 2011
+++ /playpen/LUSCA_HEAD_ipv6/src/forward.c      Sat Jul  9 07:49:03 2011
@@ -609,6 +609,7 @@
     unsigned short tos;
     int idle = -1;
     int do_tproxy = 1;
+    ConnectStateDataNew *cs;

     assert(fs);
     assert(fwdState->server_fd == -1);
@@ -766,8 +767,9 @@
      * There's no outgoing address or local host support just yet, so
      * there's no transparency support just yet.
      */
-    commConnectStartNew(host, port, fwdConnectDone, fwdState,
+    cs = commConnectStartNewSetup(host, port, fwdConnectDone, fwdState,
       NULL, 0, tos, url);
+    commConnectStartNewBegin(cs);
 }

 static void

--
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