diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-15 17:24:13 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-03-19 16:02:19 -0400 |
commit | 343f7aa05967df43c3f7e5b392b66e21c08b7cb1 (patch) | |
tree | 3ae18397f084e343189e716b2258d48e77858860 /src/common | |
parent | c6ca199888102a825f004f8613331f97525da486 (diff) | |
download | tor-343f7aa05967df43c3f7e5b392b66e21c08b7cb1.tar.gz tor-343f7aa05967df43c3f7e5b392b66e21c08b7cb1.zip |
Make the guard lifetime configurable and adjustable via the consensus
Fixes 8240.
(Don't actually increase the default guard lifetime. It seems likely to
break too many things if done precipitiously.)
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h index 8977d273c5..4642e40584 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -173,6 +173,17 @@ int n_bits_set_u8(uint8_t v); * overflow. */ #define CEIL_DIV(a,b) (((a)+(b)-1)/(b)) +/* Return <b>v</b> if it's between <b>min</b> and <b>max</b>. Otherwise + * return <b>min</b> if <b>v</b> is smaller than <b>min</b>, or <b>max</b> if + * <b>b</b> is larger than <b>max</b>. + * + * Requires that <b>min</b> is no more than <b>max</b>. May evaluate any of + * its arguments more than once! */ +#define CLAMP(min,v,max) \ + ( ((v) < (min)) ? (min) : \ + ((v) > (max)) ? (max) : \ + (v) ) + /* String manipulation */ /** Allowable characters in a hexadecimal string. */ |