[master] ce9e52123 cache_obj: refactor: pull out extension signal to client

Nils Goroll nils.goroll at uplex.de
Fri Jul 4 17:04:03 UTC 2025


commit ce9e5212325050bc1f4e2c6eef42fde3ace48613
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Sep 29 10:44:06 2024 +0200

    cache_obj: refactor: pull out extension signal to client

diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index 9ffa373f3..aa4ef2ac4 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -258,6 +258,17 @@ ObjExtend(struct worker *wrk, struct objcore *oc, ssize_t l, int final)
 /*====================================================================
  */
 
+static inline void
+objSignalFetchLocked(const struct objcore *oc, uint64_t l)
+{
+	if (oc->boc->transit_buffer > 0) {
+		assert(oc->flags & OC_F_TRANSIENT);
+		/* Signal the new client position */
+		oc->boc->delivered_so_far = l;
+		PTOK(pthread_cond_signal(&oc->boc->cond));
+	}
+}
+
 uint64_t
 ObjWaitExtend(const struct worker *wrk, const struct objcore *oc, uint64_t l,
     enum boc_state_e *statep)
@@ -272,13 +283,8 @@ ObjWaitExtend(const struct worker *wrk, const struct objcore *oc, uint64_t l,
 	while (1) {
 		rv = oc->boc->fetched_so_far;
 		assert(l <= rv || oc->boc->state == BOS_FAILED);
-		if (oc->boc->transit_buffer > 0) {
-			assert(oc->flags & OC_F_TRANSIENT);
-			/* Signal the new client position */
-			oc->boc->delivered_so_far = l;
-			PTOK(pthread_cond_signal(&oc->boc->cond));
-		}
 		state = oc->boc->state;
+		objSignalFetchLocked(oc, l);
 		if (rv > l || state >= BOS_FINISHED)
 			break;
 		(void)Lck_CondWait(&oc->boc->cond, &oc->boc->mtx);


More information about the varnish-commit mailing list