From df49d38930a32d342e1a3ab980c1ec432d138c2c Mon Sep 17 00:00:00 2001 From: dormando Date: Sat, 29 Aug 2020 17:12:56 -0700 Subject: core: generalize extstore's defered IO queue want to reuse the deferred IO system for extstore for something else. Should allow evolving into a more plugin-centric system. step one of three(?) - replace in place and tests pass with extstore enabled. step two should move more extstore code into storage.c step three should build the IO queue code without ifdef gating. --- thread.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index 15ce7a1..93f247f 100644 --- a/thread.c +++ b/thread.c @@ -442,7 +442,7 @@ static void setup_thread(LIBEVENT_THREAD *me) { } #ifdef EXTSTORE - me->io_cache = cache_create("io", sizeof(io_wrap), sizeof(char*), NULL, NULL); + me->io_cache = cache_create("io", sizeof(io_pending_t), sizeof(char*), NULL, NULL); if (me->io_cache == NULL) { fprintf(stderr, "Failed to create IO object cache\n"); exit(EXIT_FAILURE); @@ -538,6 +538,15 @@ static void thread_libevent_process(evutil_socket_t fd, short which, void *arg) } } else { c->thread = me; +#ifdef EXTSTORE + if (c->thread->storage) { + conn_io_queue_add(c, IO_QUEUE_EXTSTORE, c->thread->storage, storage_submit_cb, storage_free_cb); + } +#endif +#ifdef EXTSTORE + conn_io_queue_add(c, IO_QUEUE_NONE, NULL, NULL, NULL); +#endif + #ifdef TLS if (settings.ssl_enabled && c->ssl != NULL) { assert(c->thread && c->thread->ssl_wbuf); -- cgit v1.2.1