492 Commits

Author SHA1 Message Date
Nick Mathewson
471fbe3baf Merge remote-tracking branch 'rbalint/from-forked-daapd' 2013-12-24 12:27:24 -05:00
Nick Mathewson
a3172a415b Minor optimizations on bufferevent_trigger options
By making BEV_TRIG_DEFER_CALLBACKS equal to BEV_OPT_DEFER_CALLBACKS,
and BEV_TRIG_IGNORE_WATERMARKS disjoint from BEV_OPT_*, we can save a
few operations in bufferevent_run_*, which is critical-path.
2013-12-24 11:30:06 -05:00
Nick Mathewson
b4ef3def6f Merge remote-tracking branch 'mistotebe/bufferevent_trigger' 2013-12-24 10:33:58 -05:00
Nick Mathewson
87fa2b004a Unit tests for active_by_fd; unsupport active_by_fd(TIMEOUT)
[It turns out that event_base_active_by_fd(TIMEOUT) didn't actually
work right. Feel free to add it back in as a patch.]
2013-12-23 20:46:38 -05:00
Nick Mathewson
486594337a Add event_base_active_by_signal by analogy 2013-12-21 23:32:10 -05:00
Nick Mathewson
5c9da9a8a8 Sanity-check arguments to event_base_active_by_fd() 2013-12-21 23:21:33 -05:00
Nick Mathewson
93369ff4e9 Merge remote-tracking branch 'ghazel/event_base_active_by_fd' 2013-12-21 23:15:41 -05:00
Nick Mathewson
db7acd1310 Merge remote-tracking branch 'origin/patches-2.0' 2013-12-20 13:37:39 -05:00
Nick Mathewson
eaa79cd459 Merge remote-tracking branch 'sourceforge/patches-2.0' into patches-2.0
Conflicts:
	include/event2/event.h
2013-12-20 13:37:04 -05:00
Nick Mathewson
8cd695bf6d Typo fixes from Linus Nordberg 2013-12-20 13:35:03 -05:00
Nick Mathewson
cec62cb80a Typo fixes from Linus Nordberg 2013-12-20 13:31:29 -05:00
Nick Mathewson
031a803071 Clarify event_base_loop exit conditions 2013-12-16 12:02:21 -05:00
Nick Mathewson
45eba6ffd5 Rename flush_outdated_host_addresses to clear_host_addresses
"flush" can imply writing something out to a file or connection before
clearing it; "clear" always means "remove".  It's also potentially
misleading to say "outdated" here, since the function removes _all_
addresses regardless, not just certain outdated ones.

Also, don't free the lock in this function.  Also reindent the function.
2013-12-06 10:50:17 -05:00
Kuldeep Gupta
f03d3535af bug fix for issues #293 evdns_base_load_hosts doesn't remove outdated addresses
As mentioned at https://sourceforge.net/p/levent/bugs/293/
created a small function "evdns_base_flush_outdated_host_addresses" which removes all the previous host addresses, if user wants to clean up the list of hosts can call and use this function.
Defination of this function is part of another patch.
2013-12-06 17:06:20 +05:30
Ondřej Kuzník
a7384c7824 Add an option to trigger bufferevent event callbacks 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
61ee18b8b1 Add an option to trigger bufferevent I/O callbacks 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
4ce242bd00 Add watermark introspection 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
13a9a020e1 Document deferred eventcb behaviour 2013-12-03 23:39:13 +00:00
Ondřej Kuzník
be7bf2c768 Fix a typo 2013-12-03 23:39:13 +00:00
Nick Mathewson
ccf432b912 Try another doxygen tweak 2013-11-21 11:47:34 -05:00
Nick Mathewson
6e67b51023 Small doxygen tweaks 2013-11-21 11:30:04 -05:00
Balint Reczey
b0bd7fe1db Allow registering callback for parsing HTTP headers
Slightly changed version of Espen Jürgensen's
commit 548141e72312126fa6121f6a5f436đ251c7fb1251 for forked-daapd.
2013-11-18 18:24:15 +01:00
Julien BLACHE
8d8decf114 Add a variant of evhttp_send_reply_chunk() with a callback on evhttp_write_buffer()
evhttp_write_buffer() used by evhttp_send_reply_chunk() can take callback
executed when (part of) the buffer has been written. Using this callback to
schedule the next chunk avoids buffering large amounts of data in memory.
2013-11-18 15:39:47 +01:00
Azat Khuzhin
0c7f0405e3 http: implement new evhttp_connection_get_addr() api.
Basically tcp final handshake looks like this:
    (C - client, S - server)
    ACK[C] - FIN/ACK[S] - FIN/ACK[S] - ACK [C]

However there are servers, that didn't close connection like this,
while it is still _considered_ as valid, and using libevent http layer
we can do requests to such servers.

Modified handshake:
    (C - client, S - server)
    ACK[C] - RST/ACK[S] - RST/ACK[S]

And in this case we can't extract IP address from socket, because it is
already closed, and getpeername() will return: "transport endpoint is not connected".
So we need to store address that we are connecting to, after we know it,
and that is what this patch do.

I have reproduced it, however it have some extra packages.
(I will try to fix it)
https://github.com/azat/nfq-examples/blob/master/nfqnl_rst_fin.c
2013-10-14 11:22:29 -04:00
Nicolas Martyanoff
5a5acd9a70 add a http default content type option 2013-09-30 18:11:26 +02:00
Nick Mathewson
c149a1a5e7 Merge remote-tracking branch 'origin/patches-2.0' 2013-08-13 11:14:11 -04:00
Nick Mathewson
d44f91ad79 Finish a sentence 2013-08-13 10:59:20 -04:00
Nick Mathewson
f391b0030c Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	arc4random.c
2013-08-06 17:29:34 -04:00
Nick Mathewson
2bbb5d7612 Add evutil_secure_rng_set_urandom_device_file
This experimental function is needed for some seccomp2 hackery to
work, and should have no effect for systems that don't use it.
2013-08-06 17:06:23 -04:00
Maxime Henrion
a7f82a314f Add evhttp_connection_get_server(). 2013-07-31 21:55:13 -04:00
Mark Ellzey
1c77fbb0dc Pass and return const for bufferevent_get_token_bucket_cfg 2013-07-11 16:26:43 -04:00
Mark Ellzey
4b3d5af8e2 Add function to fetch underlying ratelimit cfg
bufferevent_get_token_bucket_cfg() will return the struct ev_token_bucket_cfg
for a bufferevent if available.
2013-07-11 12:31:39 -04:00
Mobai Zhang
0fa107d8cb Added event_base_get_num_events() 2013-07-02 16:01:02 -04:00
Nick Mathewson
0b05aa6591 Merge remote-tracking branch 'origin/patches-2.0' 2013-06-10 10:47:28 -04:00
Nick Mathewson
6e49696147 Document that arc4random is not a great cryptographic PRNG. 2013-06-10 10:38:38 -04:00
Nick Mathewson
8415b69d42 Mark the finalize stuff as experiemental in case it needs to change 2013-04-30 11:44:25 -04:00
Nick Mathewson
920a5e69b0 Clarify an important point about event_base_foreach_event() 2013-04-26 19:15:50 -04:00
Nick Mathewson
3555befd1c Merge branch '21_deadlock_fix_v2' 2013-04-26 12:27:05 -04:00
Nick Mathewson
5d11f4f39a Make the event_finalize* functions return an error code 2013-04-26 12:18:38 -04:00
Nick Mathewson
a800b913ac More documentation for finalization feature 2013-04-26 12:18:38 -04:00
Nick Mathewson
e9ebef83a0 Always run pending finalizers when event_base_free() is called
There was actually a bug in the original version of this: it tried to
run the finalizers after (potentially) setting current_base to NULL;
but those finalizers could themselves (potentially) be invoking stuff
that needed to know about the current event_base.  So the right time to
do it is _before_ clearing current_base.
2013-04-26 12:18:07 -04:00
Nick Mathewson
8eedeabe50 Implement event_finalize() and related functions to avoid certain deadlocks 2013-04-26 12:18:07 -04:00
Nick Mathewson
b3aca5d96c Merge branch '21_http_error_cb_squashed' 2013-04-25 15:13:24 -04:00
Azat Khuzhin
7b077194cc Add new error_cb for actual reporting of HTTP request errors.
It is useful to know why you callback called with NULL (i.e. it failed),
for example if you set max_body with evhttp_connection_set_max_body_size()
you must know that it failed because of body was longer than this size.

 (Commit message tweaked by Nick)
2013-04-25 15:11:44 -04:00
Azat Khuzhin
6b7fa620e8 evdns: New flag to make evdns not prevent the event loop from exiting
Here is the brief description of problem:
When you are use evdns to resolve domains to IP adresses (see
./sample/dns-example) you loop never returns from event_base_dispatch(),
and because of this the program will never terminated.

Because existing programs may be depending on the old behavior, we
only apply the fix when evdns_base_new() is created with a new flag -
EVDNS_BASE_DISABLE_WHEN_INACTIVE.

 (Commit message edited by Nick while squashing the branch.)
2013-04-25 10:43:12 -04:00
Dan Petro
cf8d1cdb20 Specify return behavior in header for evbuffer_pullup() in corner case
Function returns NULL when told to pullup more data than exists
2013-03-29 09:28:35 -07:00
Nick Mathewson
1bc4a8f99d Merge remote-tracking branch 'origin/patches-2.0' 2013-03-25 21:14:10 -04:00
Nick Mathewson
773b0a5d88 Fix a typo in a comment in buffer.h. Spotted by Alt_F4 2013-03-25 21:12:49 -04:00
Volker Lendecke
0c2bacca43 Fix typo : Dispatching instead of Dispaching 2013-01-17 10:22:33 -05:00
Greg Hazel
865a14261c event_base_active_by_fd 2013-01-16 16:31:08 -08:00