Azat Khuzhin [Tue, 18 Aug 2015 18:19:11 +0000 (21:19 +0300)]
Merge branch 'reuse-conn_address-on-retry-v11'
There is regression tests and also this code worked/tested during crawling a
huge number of pages (billions).
* reuse-conn_address-on-retry-v11:
be_sock: bufferevent_socket_set_conn_address(): assert instead of silent no-op
http: reuse connected address only with EVHTTP_CON_REUSE_CONNECTED_ADDR
be_sock: sanity check in bufferevent_socket_set_conn_address()
be: replace sockaddr_storage with sockaddr_in6 for conn_address
be: we don't need to use getpeername() we we have conn_address
be: replace conn_address by full struct instead of pointer
test/http: cover retrying with saved conn_address by shutting down dns server
http: use IP address that we got before (if any) during retrying
bufferevent: move conn_address out from http into bufferevent
be: make @sa const for bufferevent_socket_connect()
util: make @sa const for evutil_socket_connect_()
Azat Khuzhin [Tue, 2 Dec 2014 11:24:19 +0000 (14:24 +0300)]
be: replace sockaddr_storage with sockaddr_in6 for conn_address
We need only ipv6/ipv4 for connect in bufferevent, and since
sockaddr_storage is pretty big (128 bytes) it will be better to use
sockaddr_in6 here (it will fit ipv4 too).
Azat Khuzhin [Wed, 12 Nov 2014 17:23:46 +0000 (20:23 +0300)]
http: use IP address that we got before (if any) during retrying
Before this patch every time we are retrying our request we resolve
domain, but we could optimize this (since UDP is slow) by using cached
conn_address value, so do this.
Azat Khuzhin [Sat, 15 Nov 2014 18:46:11 +0000 (21:46 +0300)]
bufferevent: move conn_address out from http into bufferevent
In http the only case when when we could store it is when we already
connected, *but* if we are doing request using domain name, then we need
to do request to nameserver to get IP address, and this is handled by
bufferevent.
So when we have IP address (from nameserver) and don't have connection
to this IP address, we could already cache it to avoid extra DNS
requests (since UDP is slow), and we can't do this from http layer, only
from bufferevent.
Mark Ellzey [Fri, 15 May 2015 09:58:14 +0000 (02:58 -0700)]
Debug mode option to error on evthread init AFTER other event calls.
- A handy event_enable_debug_mode() feature which will error and abort the
application if any thread-aware libevent functions are called BEFORE the
evthread API has been initialized (manually, or through
evthread_use_windows_threads() / evthread_use_pthreads()
- This is done by setting the global debug variable
'event_debug_created_threadable_ctx_' whenever the following functions
are called:
evthreadimpl_lock_alloc_()
evthreadimpl_cond_alloc_()
event_base_new_with_config() <- this checks to see if the thread
callbacks are enabled first, so we
have to manually set the variable.
Mark Ellzey [Mon, 11 May 2015 16:47:40 +0000 (12:47 -0400)]
Fix the link for appveyor OpenSSL installer (WIN32)
* change and move the openssl self installer off to a site we own
- the old link was 404, probably due to being replaced with a newer
non-vuln version. But since we are only using this installer to
auto-build with on appveyor (not as a release), then having a file
we don't change and own seems to be a better solution.
* reduce verbosity
Mark Ellzey [Mon, 11 May 2015 16:06:01 +0000 (12:06 -0400)]
Fix garbage value in socketpair util function, stdint?
* Fixed an issue with evutil_ersatz_socketpair_, listen_addr could all
be compared against with agarbage values. So just memset it before
using it anywhere.
* Nick might punch me in the face, but if we have stdint.h; (as in
EVENT__HAVE_STDINT_H is defined), might as well use those instead of
the manual [U]INT[X}_MAX/MIN muck in there now.
Mark Ellzey [Tue, 5 May 2015 17:37:00 +0000 (10:37 -0700)]
Call underlying bev ctrl SET_FD on filtered bufferevents
If a bufferevent_filter is set on an underlying bufferevent which has
ctrl functions, bufferevent_filter needs to handle this.
For now I have added just BEV_CTRL_SET_FD, since this is needed for
bufferevent_sock to assign file descriptors to the proper
bufferevent_read/write callbacks.
A good example of the problem can be found in issue #237
https://github.com/libevent/libevent/issues/237
This does the same thing as Travis-CI but for windows.
@nmathewson
Go to: https://ci.appveyor.com/login -> Login using Github
Click **+New Project** -> Choose **Github** to the left -> Find **Libevent** in the list and click **Add**
CMake configuration files are intended to be used by other projects to find the library. Specifically the CMake find_package command can use it to find all files related to the project.
The idea is to support 2 different CMake configuration files for Libevent. One if you simply build libevent that is generated for the build tree.
And a second one that is generated for an install target that will be installed on the system and point to where on the system the lib files and such can be find.
So for instance, in the build tree the config would set the cmake variable `LIBEVENT_INCLUDE_DIRS` to `/path/to/libevent/build/include`.
And for the system config it would be set to `/usr/local/include` (or whatever target the user chose when running cmake).
Azat Khuzhin [Thu, 8 Jan 2015 01:45:27 +0000 (04:45 +0300)]
event: call event_disable_debug_mode() in libevent_global_shutdown()
This will avoid leaking of event_debug_map_HT_GROW
I buildin it into libevent_glboal_shutdown() because
event_disable_debug_mode() -> event_free_debug_globals() ->
event_free_debug_globals_locks() will clean event_debug_map_lock_ that
used in event_disable_debug_mode().
This fixes following problems in shared library build:
* visibility=hidden was not enabled for gcc because of incorrect variable name
* test programs that need internal APIs caused link errors
There is a race between manual event_active and natural event activation. If both happen at the same time on the same FD, they would both be protected by the same event base lock except for 1 LoC where the fields of struct event are read without any kind of lock. This commit does those reads into local variables inside the lock and then invokes the callback with those local arguments outside the lock. In 2.0-stable, none of this is inside the lock; in HEAD, only the callback is read inside the lock. This gets the callback and all 3 arguments inside the lock before calling it outside the lock.