X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsrc%2Flookups%2Fredis.c;h=dcd1b659cb86abaf180ef5aa91828c7200493aeb;hb=3bbf85f29be41a56c82ff8b435289c40e40f7afa;hp=e8989ca3a1580733c786d0a64b0650e1d6945c1a;hpb=94e1f16d6033683bdebaf5092f64c58bc044dd2d;p=exim.git diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c index e8989ca3a..dcd1b659c 100644 --- a/src/src/lookups/redis.c +++ b/src/src/lookups/redis.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ #include "../exim.h" @@ -241,7 +241,20 @@ switch (redis_reply->type) { case REDIS_REPLY_ERROR: *errmsg = string_sprintf("REDIS: lookup result failed: %s\n", redis_reply->str); - *defer_break = FALSE; + + /* trap MOVED cluster responses and follow them */ + if (Ustrncmp(redis_reply->str, "MOVED", 5) == 0) + { + DEBUG(D_lookup) + debug_printf("REDIS: cluster redirect %s\n", redis_reply->str); + /* follow redirect + This is cheating, we simply set defer_break = TRUE to move on to + the next server in the redis_servers list */ + *defer_break = TRUE; + return DEFER; + } else { + *defer_break = FALSE; + } *do_cache = 0; goto REDIS_EXIT; /* NOTREACHED */