454 Commits

Author SHA1 Message Date
Nick Mathewson
9ce5053d6e Merge remote-tracking branch 'origin/patches-2.0' 2011-12-06 11:02:12 -05:00
Nick Mathewson
11f36a5f76 Be absolutely sure to clear pncalls before leaving event_signal_closure
I thought we'd fixed the cases where this could come up, but
apparently having an event_base_break() happen while processing
signal events could get us in trouble.

Found by Remi Gacogne.  Sourceforge issue 3451433 .
2011-12-05 15:06:46 -05:00
Nick Mathewson
f5b937e65f Merge remote-tracking branch 'origin/patches-2.0' 2011-11-14 18:22:08 -05:00
Nick Mathewson
e787413329 Don't try to make notifiable event_base when no threading fns are configured 2011-11-14 17:33:02 -05:00
Nick Mathewson
4e797f388f Warn when unable to construct base because of failing make_base_notifiable 2011-11-14 17:32:22 -05:00
Nick Mathewson
0cb70e3333 Merge remote-tracking branch 'origin/patches-2.0' 2011-10-26 10:17:21 -04:00
Nick Mathewson
3c824bd334 Update copyright dates to 2011. 2011-10-24 13:18:09 -04:00
Abel Mathew
212533e4a1 New event_base_update_cache_time() to set cached_tv to current time
This function is particularly useful for selectively increasing
the accuracy of the cached time value in 'base' during callbacks
that take a long time to execute.

This function has no effect if the base is currently not in its
event loop or if timeval caching is disabled via EVENT_BASE_FLAG_NO_CACHE_TIME.
2011-10-21 18:08:08 -04:00
Mansour Moufid
c8953d1b48 Add argument checks to some memory functions in `event.c'.
Add a zero check to the function `event_mm_malloc_',
i.e. simply return NULL if the sz argument is zero.
On failure, set errno to ENOMEM and return NULL.

Add a zero check to the function `event_mm_calloc_',
i.e. simply return NULL if either argument is zero.
Also add an unsigned integer multiplication check, and if an integer
overflow would occur, set errno to ENOMEM and return NULL.
On failure, set errno to ENOMEM and return NULL.

Add a NULL check to the function `event_mm_strdup_',
i.e. set errno to EINVAL and return NULL.
Also add an unsigned integer addition check, and if an integer
overflow would occur, set errno to ENOMEM and return NULL.
If a memory allocation error occurs, again set errno to ENOMEM
and return NULL.

Add unit tests to `test/regress_util.c'.
2011-10-19 23:21:57 -04:00
Nick Mathewson
128c8d6c0f Merge remote-tracking branch 'origin/patches-2.0' 2011-10-19 22:44:33 -04:00
Leonid Evdokimov
9e6a4efa51 More detailed message in case of libevent self-debugging failure. 2011-10-19 22:41:15 -04:00
Nick Mathewson
3c55b5ee0a Make evbase_priority_init() and evbase_get_npriorities() threadsafe 2011-10-11 09:50:57 -04:00
Alexander Drozdov
ee3a4ee880 Add event_base_get_npriorities() function. 2011-10-11 09:43:12 -04:00
Nick Mathewson
084e68f3f2 New EVLOOP_NO_EXIT_ON_EMPTY option to keep looping even when no events are pending
This can be useful if you want to start an event loop and then add or
remove events to it from another thread.
2011-10-05 11:11:44 -04:00
Nick Mathewson
1ebe795544 Merge remote-tracking branch 'origin/patches-2.0' 2011-09-26 11:11:30 -04:00
Nick Mathewson
4e8eb6a595 When a signal callback is activated to run multiple times, allow event_base_loopbreak to work even before they all have run.
Found by Abilio Marques.
2011-09-09 20:57:54 -04:00
Nick Mathewson
2cbe115cbc Merge remote-tracking branch 'origin/patches-2.0' 2011-08-24 16:17:56 -04:00
Nick Mathewson
5b18f13048 Make rate limiting work with common_timeout logic 2011-08-24 16:17:05 -04:00
Nick Mathewson
3c63edd1f7 Make the priority inversion code use gettime(), not evutil_gettimeofday()
Since we're computing the time after each callback, we might as well
update the time cache (if we're using it) and use monotonic time (if
we've got that).
2011-08-17 22:04:04 -04:00
Nick Mathewson
a37a0c0e35 Make max_dispatch_interval able to apply only to low-priority events
Suggested by Alexander Drozdov
2011-08-17 22:03:57 -04:00
Alexander Drozdov
a9866aa8c1 Optimization in event_process_active(): ignore maxcb & endtime for highest priority events. 2011-08-17 22:03:57 -04:00
Nick Mathewson
9fa56bdf1c Make sure max_dispatch_callbacks is never negative
Suggested by Alexander Drozdov.
2011-08-17 22:03:57 -04:00
Nick Mathewson
fd4de1e7fe Add event_config function to limit time/callbacks between calls to dispatch 2011-08-17 22:03:57 -04:00
Mark Ellzey
67275433ec more event dbg updates 2011-08-11 16:53:01 -05:00
Mark Ellzey
4b7d298415 added timeout debug logs to include event ptr. 2011-08-11 13:25:24 -05:00
Mark Ellzey
3baab0dce9 Added usec debug in another area for debug 2011-08-11 12:06:54 -05:00
Mark Ellzey
ac43ce0450 Debug addition for printing usec on TIMEOUT debugging. 2011-08-11 11:56:26 -05:00
Nick Mathewson
e91d57f1f6 Merge remote-tracking branch 'github/21_split_functions'
Conflicts:
	event.c

The conflicts were with the 21_faster_timeout_adj branch, which
added a "reinsert" function that needed to get renamed to
"reinsert_timeout".  Also, some of the code that 21_split_functions
changes got removed by 21_faster_timeout_adj.
2011-08-08 16:20:53 -04:00
Nick Mathewson
24e2480520 Merge remote-tracking branch 'github/21_faster_timeout_adj' 2011-08-08 16:17:18 -04:00
Nick Mathewson
78fb99ceb2 Merge remote-tracking branch 'origin/patches-2.0' 2011-07-04 12:22:54 -04:00
Nick Mathewson
e7fe92709e Merge remote-tracking branch 'github/20_global_locks_init' into patches-2.0 2011-07-04 12:16:08 -04:00
Nick Mathewson
5099d858b1 Merge remote-tracking branch 'origin/patches-2.0' 2011-06-08 14:29:36 -04:00
Nick Mathewson
09fe97da3b Replace an assertion for event_base_free(NULL) with a check-and-warn
event_base_free(NULL) means "free the current event base".
Previously, it would assert if there was no 'current' base.  Now it
just warns and returns.

Reported by Gilad Benjamini
2011-06-08 14:24:45 -04:00
Nick Mathewson
e40bafe796 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	Makefile.am
	WIN32-Code/event2/event-config.h
	configure.in
	test/regress_ssl.c
2011-06-04 21:40:55 -04:00
Nick Mathewson
27ce38b618 Avoid a segfault when all methods are disabled or broken 2011-06-01 17:28:21 -04:00
Nick Mathewson
94b8e676f3 Allow base-notification functions to exist without setting an fd
The kqueue and evport backends can make good use of this.
2011-05-27 22:54:16 -04:00
Nick Mathewson
9f560bfa11 Use "_WIN32", not WIN32: it's standard and we don't need to fake it
This patch was automatically generated with perl.

Based on a patch by Peter Rosin.
2011-05-25 20:03:15 -04:00
Nick Mathewson
b683cae3cb Avoid race-condition when initializing global locks
Previously, we did stuff like
   if (!lock)
      EVTHREAD_ALLOC_LOCK(lock,0);
for the evsig base global lock, the arc4random lock, and the debug_map
lock.  But that's potentially racy!  Instead, we move the
responisiblity for global lock initialization to the functions where
we set up the lock callbacks.

(Rationale: We already require that you set up the locking callbacks
before you create any event_base, and that you do so exatly once.)
2011-04-22 14:06:33 -04:00
Nick Mathewson
2a83ecc849 In the 2.1 branch, let's try out lazy gettimeofday/clock_gettime comparison
For now, we'll only check for gettimeofday jumps once every 5 seconds.
Let's see how that works.

This reverts commit 5209fadfd07af3f3379ac607582c37933b33e044.
2011-03-07 23:01:54 -05:00
Nick Mathewson
4560b31bdf Merge remote branch 'origin/patches-2.0'
Conflicts:
	event-internal.h
2011-03-07 23:00:45 -05:00
Nick Mathewson
5209fadfd0 Disable lazy gettimeofday/clock_gettime comparison for now 2011-03-07 22:59:19 -05:00
Nick Mathewson
a459ef70ec Have event_base_gettimeofday_cached() always return wall-clock time
Based on code by Dave Hart
2011-03-03 15:48:26 -05:00
Nick Mathewson
d1cee3b1c7 Make event_count maintainance branchless at the expense of an extra shift. Needs benchmarking 2011-02-23 01:08:54 -05:00
Nick Mathewson
efc4dc503a possible optimization: split event_queue_insert/remove into separate functions. needs testing 2011-02-23 00:59:20 -05:00
Nick Mathewson
77a96fd901 Remove a needless base-notify when rescheduling the first timeout
We don't need to wake up the base when rescheduling the timeout that
will expire first: the base will already wake up, see that nothing is
ready, and go back to sleep.
2011-02-02 20:09:16 -05:00
Nick Mathewson
e47042fe26 Optimize the case where we reinsert an existing timeout 2011-02-02 20:08:00 -05:00
Kevin Bowling
0915ca0aa6 Include evconfig-private.h in internal files for great good. 2011-01-02 08:43:45 -07:00
Nick Mathewson
5beeec9d43 Correctly notify the main thread when activating an event from a subthread 2010-12-01 21:28:03 -05:00
Nick Mathewson
2e5a175bf3 Merge remote branch 'github/20_once_fixes' 2010-11-25 23:03:46 -05:00
Nick Mathewson
652024b6b1 Remove _event_initialized(); make event_initialized() a function(); make it consistent on windows and non-windows 2010-11-23 13:08:07 -05:00