r4416 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Dec 16 14:02:42 CET 2009
Author: phk
Date: 2009-12-16 14:02:42 +0100 (Wed, 16 Dec 2009)
New Revision: 4416
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_hash.c
trunk/varnish-cache/bin/varnishd/hash_slinger.h
Log:
Put the hash-digest into struct sess, let HSH_Lookup grab it from
there. Saves some pointless calling forth and back and makes the
hash available for other uses.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2009-12-16 12:31:57 UTC (rev 4415)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2009-12-16 13:02:42 UTC (rev 4416)
@@ -100,6 +100,9 @@
struct lock { void *priv; }; // Opaque
+#define DIGEST_LEN 32
+
+
/*--------------------------------------------------------------------*/
typedef struct {
@@ -383,6 +386,8 @@
char *ws_ses; /* WS above session data */
char *ws_req; /* WS above request data */
+ unsigned char digest[DIGEST_LEN];
+
struct http_conn htc[1];
/* Timestamps, all on TIM_real() timescale */
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-12-16 12:31:57 UTC (rev 4415)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-12-16 13:02:42 UTC (rev 4416)
@@ -78,6 +78,7 @@
#include "cache.h"
#include "hash_slinger.h"
#include "stevedore.h"
+#include "vsha256.h"
static unsigned xids;
@@ -1034,10 +1035,10 @@
return (0);
}
- HSH_BeforeVclHash(sp);
+ SHA256_Init(sp->wrk->sha256ctx);
VCL_hash_method(sp);
assert(sp->handling == VCL_RET_HASH);
- HSH_AfterVclHash(sp);
+ SHA256_Final(sp->digest, sp->wrk->sha256ctx);
if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) {
sp->wantbody = 0;
Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-12-16 12:31:57 UTC (rev 4415)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2009-12-16 13:02:42 UTC (rev 4416)
@@ -172,21 +172,6 @@
}
void
-HSH_BeforeVclHash(const struct sess *sp)
-{
-
- SHA256_Init(sp->wrk->sha256ctx);
-}
-
-void
-HSH_AfterVclHash(const struct sess *sp)
-{
-
- HSH_Prealloc(sp);
- SHA256_Final(sp->wrk->nobjhead->digest, sp->wrk->sha256ctx);
-}
-
-void
HSH_AddString(const struct sess *sp, const char *str)
{
int l;
@@ -339,6 +324,7 @@
w = sp->wrk;
HSH_Prealloc(sp);
+ memcpy(sp->wrk->nobjhead->digest, sp->digest, sizeof sp->digest);
if (params->diag_bitmap & 0x80000000)
hsh_testmagic(sp->wrk->nobjhead->digest);
Modified: trunk/varnish-cache/bin/varnishd/hash_slinger.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_slinger.h 2009-12-16 12:31:57 UTC (rev 4415)
+++ trunk/varnish-cache/bin/varnishd/hash_slinger.h 2009-12-16 13:02:42 UTC (rev 4416)
@@ -61,16 +61,12 @@
double HSH_Grace(double g);
void HSH_Init(void);
void HSH_AddString(const struct sess *sp, const char *str);
-void HSH_BeforeVclHash(const struct sess *sp);
-void HSH_AfterVclHash(const struct sess *sp);
void HSH_DerefObjCore(struct sess *sp);
void HSH_FindBan(struct sess *sp, struct objcore **oc);
struct objcore *HSH_Insert(const struct sess *sp);
#ifdef VARNISH_CACHE_CHILD
-#define DIGEST_LEN 32
-
struct objhead {
unsigned magic;
#define OBJHEAD_MAGIC 0x1b96615d
More information about the varnish-commit
mailing list