diff options
author | dormando <dormando@rydia.net> | 2011-08-09 11:10:22 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2011-08-10 08:44:52 -0700 |
commit | 36b83f876ecbb94bc44acfd107843b4659b71f97 (patch) | |
tree | 7c6ea79642bed6fd1a800c60a73468c3d61d81f5 | |
parent | 51c6550f71b238a13f9dbc74764b8a8f3926eb3a (diff) | |
download | memcached-36b83f876ecbb94bc44acfd107843b4659b71f97.tar.gz |
Immediately expire negative exptime for asciiprot
Negative values larger than the server start time used to become immortal. Now
it's set to REALTIME_MAXDELTA + 1 in an attempt to immediately expire it.
-rw-r--r-- | memcached.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/memcached.c b/memcached.c index e0bbf89..e47920f 100644 --- a/memcached.c +++ b/memcached.c @@ -2737,6 +2737,12 @@ static void process_update_command(conn *c, token_t *tokens, const size_t ntoken /* Ubuntu 8.04 breaks when I pass exptime to safe_strtol */ exptime = exptime_int; + /* Negative exptimes can underflow and end up immortal. realtime() will + immediately expire values that are greater than REALTIME_MAXDELTA, but less + than process_started, so lets aim for that. */ + if (exptime < 0) + exptime = REALTIME_MAXDELTA + 1; + // does cas value exist? if (handle_cas) { if (!safe_strtoull(tokens[5].value, &req_cas_id)) { |