From 39f0aa35b61088985c5a6bdbf6cc63c60c447c00 Mon Sep 17 00:00:00 2001 From: "Troy D. Hanson" Date: Wed, 22 Oct 2014 19:58:11 -0400 Subject: [PATCH] fix outidx iteration and adjust internal rescan --- include/kvspool_internal.h | 2 +- src/kvspoolr.c | 2 +- utils/kvsp-tpub.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/kvspool_internal.h b/include/kvspool_internal.h index febb50a..1d29c01 100644 --- a/include/kvspool_internal.h +++ b/include/kvspool_internal.h @@ -11,7 +11,7 @@ #define KVSPOOL_MAGIC "KV+SPOOL" /* (reader): scan for new readable spools when > x seconds elapse */ -#define KVSPOOL_RESCAN_INTERVAL 10 /* seconds */ +#define KVSPOOL_RESCAN_INTERVAL 1 /* seconds */ /* (writer) attrition as needed to keep the total spool size approx under x */ /* 1 GB is a default but this can be configured using the 'limits' file. */ diff --git a/src/kvspoolr.c b/src/kvspoolr.c index 6a63235..840dce7 100644 --- a/src/kvspoolr.c +++ b/src/kvspoolr.c @@ -13,7 +13,7 @@ #include "utstring.h" #include "tpl.h" -#define INTERNAL_RESCAN_INTERVAL_SEC (10) +#define INTERNAL_RESCAN_INTERVAL_SEC (1) typedef struct { char *srpath; /* e.g. /tmp/myspool/spool.123456789.999-000.sr */ diff --git a/utils/kvsp-tpub.c b/utils/kvsp-tpub.c index 77b14ee..7d44069 100644 --- a/utils/kvsp-tpub.c +++ b/utils/kvsp-tpub.c @@ -70,7 +70,7 @@ void mark_writable() { UT_string **s=NULL; while ( (fd=(int*)utarray_next(cfg.clients,fd))) { s=(UT_string**)utarray_next(cfg.outbufs,s); assert(s); - i=(int*)utarray_next(cfg.outidxs,s); assert(i); + i=(int*)utarray_next(cfg.outidxs,i); assert(i); if (utstring_len(*s) > *i) mod_epoll(EPOLLIN|EPOLLOUT, *fd); } } @@ -168,7 +168,7 @@ void shift_buffers() { while ( (fd=(int*)utarray_next(cfg.clients,fd))) { s=(UT_string**)utarray_next(cfg.outbufs,s); assert(s); - i=(int*)utarray_next(cfg.outidxs,s); assert(i); + i=(int*)utarray_next(cfg.outidxs,i); assert(i); len = utstring_len(*s); if (*i == 0) continue; // nothing to shift