r429 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Tue Jul 11 17:54:05 CEST 2006
Author: phk
Date: 2006-07-11 17:54:05 +0200 (Tue, 11 Jul 2006)
New Revision: 429
Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
Make things work again by stuffing the old functions into the new
state engine.
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-07-11 15:18:54 UTC (rev 428)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-07-11 15:54:05 UTC (rev 429)
@@ -41,37 +41,6 @@
#include "vcl.h"
#include "cache.h"
-/*--------------------------------------------------------------------*/
-
-static int
-LookupSession(struct worker *w, struct sess *sp)
-{
- struct object *o;
-
- o = HSH_Lookup(w, sp->http);
- sp->obj = o;
- if (o->busy) {
- VSL_stats->cache_miss++;
- VCL_miss_method(sp);
- } else {
- VSL_stats->cache_hit++;
- VSL(SLT_Hit, sp->fd, "%u", o->xid);
- VCL_hit_method(sp);
- }
- return (0);
-}
-
-static int
-DeliverSession(struct worker *w, struct sess *sp)
-{
-
-
- vca_write_obj(w, sp);
- HSH_Deref(sp->obj);
- sp->obj = NULL;
- return (1);
-}
-
/*--------------------------------------------------------------------
DOT subgraph cluster_deliver {
DOT deliver [
@@ -97,17 +66,21 @@
DOT ]
*/
-#if 0
+
+static void
+cnt_done(struct worker *w, struct sess *sp)
+{
+ char *b;
+
if (http_GetHdr(sp->http, "Connection", &b) &&
!strcmp(b, "close")) {
vca_close_session(sp, "Connection header");
} else if (http_GetProto(sp->http, &b) &&
strcmp(b, "HTTP/1.1")) {
vca_close_session(sp, "not HTTP/1.1");
-#endif
+ }
+}
-static void cnt_done(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
-
/*--------------------------------------------------------------------
DOT subgraph cluster_error {
DOT error [
@@ -203,8 +176,18 @@
DOT hit2 -> DELIVER [style=bold]
*/
-static void cnt_hit(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
+static void
+cnt_hit(struct worker *w, struct sess *sp)
+{
+ VCL_hit_method(sp);
+
+ vca_write_obj(w, sp);
+ HSH_Deref(sp->obj);
+ sp->obj = NULL;
+ sp->step = STP_DONE;
+}
+
/*--------------------------------------------------------------------
DOT subgraph cluster_lookup {
DOT lookup [
@@ -222,8 +205,23 @@
DOT lookup2 -> MISS [label="miss", style=bold]
*/
-static void cnt_lookup(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
+static void
+cnt_lookup(struct worker *w, struct sess *sp)
+{
+ struct object *o;
+ o = HSH_Lookup(w, sp->http);
+ sp->obj = o;
+ if (o->busy) {
+ VSL_stats->cache_miss++;
+ sp->step = STP_MISS;
+ } else {
+ VSL_stats->cache_hit++;
+ VSL(SLT_Hit, sp->fd, "%u", o->xid);
+ sp->step = STP_HIT;
+ }
+}
+
/*--------------------------------------------------------------------
DOT subgraph cluster_miss {
DOT miss [
@@ -259,8 +257,26 @@
DOT
*/
-static void cnt_miss(struct worker *w, struct sess *sp) { (void)w; (void)sp; INCOMPL(); }
+static void
+cnt_miss(struct worker *w, struct sess *sp)
+{
+ VCL_miss_method(sp);
+ if (sp->handling == VCL_RET_ERROR)
+ INCOMPL();
+ if (sp->handling == VCL_RET_PASS)
+ INCOMPL();
+ if (sp->handling == VCL_RET_LOOKUP)
+ INCOMPL();
+ if (sp->handling == VCL_RET_FETCH) {
+ /* XXX */
+ FetchSession(w, sp);
+ sp->step = STP_DONE;
+ return;
+ }
+ INCOMPL();
+}
+
/*--------------------------------------------------------------------
DOT subgraph cluster_pass {
DOT pass [
@@ -391,6 +407,8 @@
}
}
+ cnt_done(w, sp); /* The loop doesn't do this */
+
AZ(pthread_mutex_lock(&sessmtx));
RelVCL(sp->vcl);
AZ(pthread_mutex_unlock(&sessmtx));
More information about the varnish-commit
mailing list