Unverified Commit 12db7fc5 authored by Nils Goroll's avatar Nils Goroll

Use new ObjWaitExtend API

Fixes #44 properly

Ref https://github.com/varnishcache/varnish-cache/pull/4109
parent 0e37ec9f
......@@ -320,6 +320,7 @@ sbu_iterator(struct worker *wrk, struct objcore *oc,
}
while (1) {
ol = len;
#if VRT_MAJOR_VERSION < 19U || (VRT_MAJOR_VERSION == 19 && VRT_MINOR_VERSION < 1)
nl = ObjWaitExtend(wrk, oc, ol);
if (boc->state == BOS_FAILED) {
ret = -1;
......@@ -330,6 +331,18 @@ sbu_iterator(struct worker *wrk, struct objcore *oc,
break;
continue;
}
#else
nl = ObjWaitExtend(wrk, oc, ol, &state);
if (state == BOS_FAILED) {
ret = -1;
break;
}
if (nl == ol) {
assert (state == BOS_FINISHED);
break;
}
assert(nl > ol);
#endif
Lck_Lock(&boc->mtx);
assert(VTAILQ_FIRST(&obj->list));
if (checkpoint == NULL) {
......@@ -371,7 +384,6 @@ sbu_iterator(struct worker *wrk, struct objcore *oc,
st = VTAILQ_PREV(st, sbu_head, list);
if (st != NULL && st->len == 0)
st = NULL;
state = boc->state;
Lck_Unlock(&boc->mtx);
assert(l > 0 || state == BOS_FINISHED);
u = 0;
......
......@@ -715,6 +715,7 @@ struct fellow_stream {
ssize_t checkpoint; // up to this segment
};
#if VRT_MAJOR_VERSION < 19U || (VRT_MAJOR_VERSION == 19 && VRT_MINOR_VERSION < 1)
/*
* NOTE on state shenanigans:
*
......@@ -746,6 +747,22 @@ fellow_stream_wait(struct fellow_stream *fs)
return (state2);
}
#else
static enum boc_state_e
fellow_stream_wait(struct fellow_stream *fs)
{
uint64_t l;
CHECK_OBJ_NOTNULL(fs, FELLOW_STREAM_MAGIC);
l = (uint64_t)fs->available;
l = ObjWaitExtend(fs->wrk, fs->oc, l, &fs->state);
fs->available = (ssize_t)l;
return (fs->state);
}
#endif
/* called on each (potentially busy) segment's data */
static int v_matchproto_(objiterate_f)
......
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