Commit 87c58fd4 authored by Geoff Simmons's avatar Geoff Simmons

Update VSB handling for Varnish 7.x.

parent cf596c3d
...@@ -350,8 +350,10 @@ static void wrk_cleanup(void) ...@@ -350,8 +350,10 @@ static void wrk_cleanup(void)
{ {
if (cleaned) return; if (cleaned) return;
for (int i = 0; i < config.nworkers; i++) for (int i = 0; i < config.nworkers; i++) {
VSB_fini(thread_data[i].wrk_data->sb);
free(thread_data[i].wrk_data); free(thread_data[i].wrk_data);
}
free(thread_data); free(thread_data);
AZ(pthread_mutex_destroy(&spmcq_datawaiter_lock)); AZ(pthread_mutex_destroy(&spmcq_datawaiter_lock));
AZ(pthread_cond_destroy(&spmcq_datawaiter_cond)); AZ(pthread_cond_destroy(&spmcq_datawaiter_cond));
...@@ -361,6 +363,8 @@ static void wrk_cleanup(void) ...@@ -361,6 +363,8 @@ static void wrk_cleanup(void)
int int
WRK_Init(void) WRK_Init(void)
{ {
char *recbuf;
thread_data thread_data
= (thread_data_t *) malloc(config.nworkers * sizeof(thread_data_t)); = (thread_data_t *) malloc(config.nworkers * sizeof(thread_data_t));
...@@ -383,7 +387,9 @@ WRK_Init(void) ...@@ -383,7 +387,9 @@ WRK_Init(void)
wrk->magic = WORKER_DATA_MAGIC; wrk->magic = WORKER_DATA_MAGIC;
wrk->sb = (struct vsb *) malloc(sizeof(struct vsb)); wrk->sb = (struct vsb *) malloc(sizeof(struct vsb));
AN(wrk->sb); AN(wrk->sb);
AN(VSB_new(wrk->sb, NULL, config.max_reclen + 1, VSB_FIXEDLEN)); recbuf = (char *) malloc(config.max_reclen + 1);
AN(recbuf);
AN(VSB_init(wrk->sb, recbuf, config.max_reclen + 1));
VSTAILQ_INIT(&wrk->freerec); VSTAILQ_INIT(&wrk->freerec);
wrk->nfree_rec = 0; wrk->nfree_rec = 0;
VSTAILQ_INIT(&wrk->freechunk); VSTAILQ_INIT(&wrk->freechunk);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment