Revision: 14456
Author: adrian.chadd
Date: Sun Mar 14 06:33:11 2010
Log: Migrate the bulk of the client-side logging hackery into httpRequestLog().


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

Modified:
 /branches/LUSCA_HEAD/src/client_side.c

=======================================
--- /branches/LUSCA_HEAD/src/client_side.c      Wed Mar  3 19:06:16 2010
+++ /branches/LUSCA_HEAD/src/client_side.c      Sun Mar 14 06:33:11 2010
@@ -239,23 +239,23 @@
     }
 }

-void
-httpRequestFree(void *data)
-{
-    clientHttpRequest *http = data;
-    ConnStateData *conn = http->conn;
-    StoreEntry *e;
-    request_t *request = http->request;
+/*
+ * The bulk of the client-side request/reply logging code.
+ *
+ * Note that some of this code handles non-logging cleanups -
+ * mostly because it's firstly just a straight refactor from
+ * the original source code with minimal program flow changes.
+ * I'll investigate what needs changing in a later commit
+ * to be sure that the modifications in question don't
+ * inadvertently break things.
+ */
+static void
+httpRequestLog(clientHttpRequest *http)
+{
     MemObject *mem = NULL;
-    debug(33, 3) ("httpRequestFree: %s\n", storeUrl(http->entry));
-    if (!clientCheckTransferDone(http)) {
-       requestAbortBody(request);      /* abort request body transter */
-       /* HN: This looks a bit odd.. why should client_side care about
-        * the ICP selection status?
-        */
-       if (http->entry && http->entry->ping_status == PING_WAITING)
-           storeReleaseRequest(http->entry);
-    }
+    request_t *request = http->request;
+    ConnStateData *conn = http->conn;
+
     assert(http->log_type < LOG_TYPE_MAX);
     if (http->entry)
        mem = http->entry->mem_obj;
@@ -322,12 +322,33 @@
        aclChecklistFree(http->acl_checklist);
     if (request)
        checkFailureRatio(request->err_type, http->al.hier.code);
-    safe_free(http->uri);
-    safe_free(http->log_uri);
     safe_free(http->al.headers.request);
     safe_free(http->al.headers.reply);
     safe_free(http->al.cache.authuser);
     http->al.request = NULL;
+}
+
+void
+httpRequestFree(void *data)
+{
+    clientHttpRequest *http = data;
+    StoreEntry *e;
+    request_t *request = http->request;
+
+    debug(33, 3) ("httpRequestFree: %s\n", storeUrl(http->entry));
+    if (!clientCheckTransferDone(http)) {
+       requestAbortBody(request);      /* abort request body transter */
+       /* HN: This looks a bit odd.. why should client_side care about
+        * the ICP selection status?
+        */
+       if (http->entry && http->entry->ping_status == PING_WAITING)
+           storeReleaseRequest(http->entry);
+    }
+
+    httpRequestLog(http);
+
+    safe_free(http->uri);
+    safe_free(http->log_uri);
     safe_free(http->redirect.location);
     stringClean(&http->range_iter.boundary);
if (http->old_entry && http->old_entry->mem_obj && http->old_entry->mem_obj->ims_entry && http->old_entry->mem_obj->ims_entry == http->entry) {

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