From: Emeric Brun Date: Thu, 28 May 2020 12:39:30 +0000 (+0200) Subject: MINOR: ring: re-work ring attach generic API. X-Git-Tag: v2.2-dev9~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dcd58afaf19e021c14d0914aaa7ea125f7d74758;p=thirdparty%2Fhaproxy.git MINOR: ring: re-work ring attach generic API. Attach is now independent on appctx, which was unused anyway. --- diff --git a/include/proto/ring.h b/include/proto/ring.h index d927b389a7..8adbb9c520 100644 --- a/include/proto/ring.h +++ b/include/proto/ring.h @@ -30,7 +30,7 @@ struct ring *ring_new(size_t size); struct ring *ring_resize(struct ring *ring, size_t size); void ring_free(struct ring *ring); ssize_t ring_write(struct ring *ring, size_t maxlen, const struct ist pfx[], size_t npfx, const struct ist msg[], size_t nmsg); -int ring_attach_appctx(struct ring *ring, struct appctx *appctx); +int ring_attach(struct ring *ring); void ring_detach_appctx(struct ring *ring, struct appctx *appctx, size_t ofs); int ring_attach_cli(struct ring *ring, struct appctx *appctx); int cli_io_handler_show_ring(struct appctx *appctx); diff --git a/src/ring.c b/src/ring.c index b6fc4c1dd9..2a6bb02d18 100644 --- a/src/ring.c +++ b/src/ring.c @@ -206,7 +206,7 @@ ssize_t ring_write(struct ring *ring, size_t maxlen, const struct ist pfx[], siz * already attached. On success, the caller MUST call ring_detach_appctx() * to detach itself, even if it was never woken up. */ -int ring_attach_appctx(struct ring *ring, struct appctx *appctx) +int ring_attach(struct ring *ring) { int users = ring->readers_count; @@ -245,7 +245,7 @@ void ring_detach_appctx(struct ring *ring, struct appctx *appctx, size_t ofs) */ int ring_attach_cli(struct ring *ring, struct appctx *appctx) { - if (!ring_attach_appctx(ring, appctx)) + if (!ring_attach(ring)) return cli_err(appctx, "Sorry, too many watchers (255) on this ring buffer. " "What could it have so interesting to attract so many watchers ?");