struct vrt_backend;
struct cli_proto;
struct ban;
+struct SHA256Context;
+
struct lock { void *priv; }; // Opaque
/*--------------------------------------------------------------------*/
unsigned char *wlb, *wlp, *wle;
unsigned wlr;
+
+ struct SHA256Context *sha256ctx;
};
/* Work Request for worker thread ------------------------------------*/
#include "cache.h"
#include "stevedore.h"
#include "hash_slinger.h"
+#include "vsha256.h"
static const struct hash_slinger *hash;
if (u)
p += sizeof(const char *) - u;
sp->hashptr = (void*)p;
+ if (params->hash_sha256)
+ SHA256_Init(sp->wrk->sha256ctx);
}
void
sp->hashptr[sp->ihashptr + 1] = str + l;
sp->ihashptr += 2;
sp->lhashptr += l + 1;
+ if (params->hash_sha256) {
+ SHA256_Update(sp->wrk->sha256ctx, str, l);
+ SHA256_Update(sp->wrk->sha256ctx, "#", 1);
+ }
}
struct object *
struct http *h;
struct objhead *oh;
struct object *o, *busy_o, *grace_o;
+ unsigned char sha256[32];
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
AN(hash);
w = sp->wrk;
h = sp->http;
+ if (params->hash_sha256) {
+ SHA256_Final(sha256, sp->wrk->sha256ctx);
+ /* WSP(sp, SLT_Debug, "SHA256: <%.32s>", sha256); */
+ }
HSH_Prealloc(sp);
if (sp->objhead != NULL) {
#include "cache.h"
#include "stevedore.h"
#include "hash_slinger.h"
+#include "vsha256.h"
VTAILQ_HEAD(workerhead, worker);
struct worker *w, ww;
struct wq *qp;
unsigned char wlog[params->shm_workspace];
+ struct SHA256Context sha256;
THR_SetName("cache-worker");
w = &ww;
w->lastused = NAN;
w->wlb = w->wlp = wlog;
w->wle = wlog + sizeof wlog;
+ w->sha256ctx = &sha256;
AZ(pthread_cond_init(&w->cond, NULL));
VSL(SLT_WorkThread, 0, "%p start", w);