summaryrefslogtreecommitdiff
path: root/event-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-04-09 11:30:46 -0400
committerNick Mathewson <nickm@torproject.org>2012-04-09 11:30:46 -0400
commit3aa44159c53af1d6459a85dc1841c7c494d52464 (patch)
treebf545d67d57ab47bb0f262a3a9e78394c64162c0 /event-internal.h
parente86af4b7e56ed5b7050cb4f41ae534f54748598c (diff)
downloadlibevent-3aa44159c53af1d6459a85dc1841c7c494d52464.tar.gz
Tweak the new evutil_weakrand_() code
Make its state actually get seeded. Document it more thoroughly. Turn its state into a structure. Fix a bug in evutil_weakrand_range_() where it could return the top of the range. Change its return type to ev_int32_t. Add a quick unit test to make sure that the value of evutil_weakrand_range_() is in range.
Diffstat (limited to 'event-internal.h')
-rw-r--r--event-internal.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/event-internal.h b/event-internal.h
index 4c882056..78b3fe63 100644
--- a/event-internal.h
+++ b/event-internal.h
@@ -291,8 +291,9 @@ struct event_base {
/** A function used to wake up the main thread from another thread. */
int (*th_notify_fn)(struct event_base *base);
- /* Saved seed for weak random number generator. */
- ev_uint32_t weakrand_seed;
+ /** Saved seed for weak random number generator. Some backends use
+ * this to produce fairness among sockets. Protected by th_base_lock. */
+ struct evutil_weakrand_state weakrand_seed;
};
struct event_config_entry {