Revision: 14397
Author: adrian.chadd
Date: Thu Feb 11 02:08:09 2010
Log: * Migrate the refresh check helper logic out of the client side code - the
  bulk of the code is elsewhere (refresh_check.c)
* Un-staticify some more of the client_side.c processing routines and build
  a small transition API for use by the other client_side_* routines to
  continue HTTP request/reply processing.


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

Added:
 /branches/LUSCA_HEAD/src/client_side.h
 /branches/LUSCA_HEAD/src/client_side_refresh.c
 /branches/LUSCA_HEAD/src/client_side_refresh.h
Modified:
 /branches/LUSCA_HEAD/src/Makefile.am
 /branches/LUSCA_HEAD/src/client_side.c

=======================================
--- /dev/null
+++ /branches/LUSCA_HEAD/src/client_side.h      Thu Feb 11 02:08:09 2010
@@ -0,0 +1,19 @@
+#ifndef        __CLIENT_SIDE_H__
+#define        __CLIENT_SIDE_H__
+
+/*
+ * These routines are exported to other client-side modules but not
+ * to the rest of the codebase. They form a transition API whilst
+ * the codebase is being further reorganised and refactored.
+ * Do not write new code which calls them unless you're absolutely
+ * sure of what you're doing!
+ */
+extern void clientProcessHit(clientHttpRequest * http);
+extern void clientProcessMiss(clientHttpRequest * http);
+extern void clientProcessRequest(clientHttpRequest *);
+extern void clientProcessExpired(clientHttpRequest *);
+extern void clientProcessOnlyIfCachedMiss(clientHttpRequest * http);
+extern void httpRequestFree(void *data);
+
+
+#endif
=======================================
--- /dev/null
+++ /branches/LUSCA_HEAD/src/client_side_refresh.c      Thu Feb 11 02:08:09 2010
@@ -0,0 +1,24 @@
+#include "squid.h"
+
+#include "client_side_refresh.h"
+#include "client_side.h"
+
+static void
+clientRefreshCheckDone(void *data, int fresh, const char *log)
+{
+    clientHttpRequest *http = data;
+    if (log) {
+        safe_free(http->al.ext_refresh);
+        http->al.ext_refresh = xstrdup(log);
+    }
+    if (fresh)
+        clientProcessHit(http);
+    else
+        clientProcessExpired(http);
+}
+
+void
+clientRefreshCheck(clientHttpRequest * http)
+{
+    refreshCheckSubmit(http->entry, clientRefreshCheckDone, http);
+}
=======================================
--- /dev/null
+++ /branches/LUSCA_HEAD/src/client_side_refresh.h      Thu Feb 11 02:08:09 2010
@@ -0,0 +1,6 @@
+#ifndef        __CLIENT_SIDE_REFRESH_H__
+#define        __CLIENT_SIDE_REFRESH_H__
+
+extern void clientRefreshCheck(clientHttpRequest * http);
+
+#endif
=======================================
--- /branches/LUSCA_HEAD/src/Makefile.am        Wed Feb 10 23:17:59 2010
+++ /branches/LUSCA_HEAD/src/Makefile.am        Thu Feb 11 02:08:09 2010
@@ -113,6 +113,7 @@
        client_side_nat.c \
        client_side_rewrite.c \
        client_side_ranges.c \
+       client_side_refresh.c \
        client_side_async_refresh.c \
        client_side_storeurl_rewrite.c \
        client_side_location_rewrite.c \
=======================================
--- /branches/LUSCA_HEAD/src/client_side.c      Thu Feb 11 01:39:39 2010
+++ /branches/LUSCA_HEAD/src/client_side.c      Thu Feb 11 02:08:09 2010
@@ -101,6 +101,8 @@
 #include "client_side_ranges.h"
 #include "client_side_async_refresh.h"

+#include "client_side.h"
+
 #if LINGERING_CLOSE
 #define comm_close comm_lingering_close
 #endif
@@ -120,8 +122,6 @@
 static int clientCheckTransferDone(clientHttpRequest *);
 static int clientGotNotEnough(clientHttpRequest *);
 static void checkFailureRatio(err_type, hier_code);
-static void clientProcessMiss(clientHttpRequest *);
-static void clientProcessHit(clientHttpRequest * http);
static void clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep); static clientHttpRequest *parseHttpRequestAbort(ConnStateData * conn, method_t ** method_p, const char *uri); static clientHttpRequest *parseHttpRequest(ConnStateData *, HttpMsgBuf *, method_t **, int *);
@@ -137,10 +137,6 @@
 static STHCB clientSendHeaders;
 static STHCB clientCacheHit;
 static void clientSetKeepaliveFlag(clientHttpRequest *);
-static void clientProcessExpired(clientHttpRequest *);
-static void clientRefreshCheck(clientHttpRequest *);
-static REFRESHCHECK clientRefreshCheckDone;
-static void clientProcessOnlyIfCachedMiss(clientHttpRequest * http);
 static int clientCachable(clientHttpRequest * http);
 static int clientHierarchical(clientHttpRequest * http);
 static int clientCheckContentLength(request_t * r);
@@ -320,27 +316,7 @@
        http);
 }

-static void
-clientRefreshCheck(clientHttpRequest * http)
-{
-    refreshCheckSubmit(http->entry, clientRefreshCheckDone, http);
-}
-
-static void
-clientRefreshCheckDone(void *data, int fresh, const char *log)
-{
-    clientHttpRequest *http = data;
-    if (log) {
-       safe_free(http->al.ext_refresh);
-       http->al.ext_refresh = xstrdup(log);
-    }
-    if (fresh)
-       clientProcessHit(http);
-    else
-       clientProcessExpired(http);
-}
-
-static void
+void
 clientProcessExpired(clientHttpRequest * http)
 {
     char *url = http->uri;
@@ -1917,7 +1893,7 @@
     clientProcessHit(http);
 }

-static void
+void
 clientProcessHit(clientHttpRequest * http)
 {
     int is_modified = http->is_modified;
@@ -2684,7 +2660,7 @@
  *     contacting other servers;
  * respond with a 504 (Gateway Timeout) as suggested in [RFC 2068]
  */
-static void
+void
 clientProcessOnlyIfCachedMiss(clientHttpRequest * http)
 {
     char *url = http->uri;
@@ -2968,7 +2944,7 @@
 /*
  * Prepare to fetch the object as it's a cache miss of some kind.
  */
-static void
+void
 clientProcessMiss(clientHttpRequest * http)
 {
     char *url = http->uri;

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