summaryrefslogtreecommitdiff
path: root/crawler.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-01-06 00:29:49 -0800
committerdormando <dormando@rydia.net>2017-01-06 00:29:49 -0800
commite9e2819387a77f37991fa77e6e79f6784de01291 (patch)
tree432bc7a163637e8c194bb0b0b4ab2ad442b1c4ff /crawler.c
parentd58171e8d7d0b1ecbc81cce5ddd57a77f82c5b5a (diff)
downloadmemcached-e9e2819387a77f37991fa77e6e79f6784de01291.tar.gz
metadump: ensure buffer is flushed before finish
if more than one write/poll() worth of data is in the bipbuf but the crawl is complete, the client might get released back with an incomplete write.
Diffstat (limited to 'crawler.c')
-rw-r--r--crawler.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/crawler.c b/crawler.c
index fc7567c..0d6da71 100644
--- a/crawler.c
+++ b/crawler.c
@@ -400,12 +400,12 @@ static void *item_crawler_thread(void *arg) {
if (active_crawler_mod.mod != NULL) {
if (active_crawler_mod.mod->finalize != NULL)
active_crawler_mod.mod->finalize(&active_crawler_mod);
- if (active_crawler_mod.c.c != NULL) {
+ while (active_crawler_mod.c.c != NULL && bipbuf_used(active_crawler_mod.c.buf)) {
lru_crawler_poll(&active_crawler_mod.c);
- // Double checking in case the client closed during the poll
- if (active_crawler_mod.c.c != NULL) {
- lru_crawler_release_client(&active_crawler_mod.c);
- }
+ }
+ // Double checking in case the client closed during the poll
+ if (active_crawler_mod.c.c != NULL) {
+ lru_crawler_release_client(&active_crawler_mod.c);
}
active_crawler_mod.mod = NULL;
}