3444 Commits

Author SHA1 Message Date
Mark Ellzey
3499ad9729 Set correct socklen for PF_INET6 sockaddr len
Reported and patched by Pankaj Sharma
2015-06-01 06:55:24 -07:00
Mark Ellzey
c6fffc7547 Merge pull request #251 from ellzey/21_err_on_thread_init_ordering
Debug mode option to error on evthread init AFTER other event calls.
2015-05-29 06:47:24 -07:00
Mark Ellzey
dcfb19a27b 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.

- Example:

int main(int argc, char ** argv) {
    struct event_base * base;

    event_enable_debug_mode();

    base = event_base_new();

    evthread_use_pthreads();

    return 0;
}

When executed, the program will throw an error and exit:

[err] evthread initialization must be called BEFORE anything else!
2015-05-15 02:58:14 -07:00
Mark Ellzey
6c8cb5ef7e Merge pull request #245 from ellzey/21_size_and_misc_fixes
Fix garbage value in socketpair util function, stdint?
2015-05-13 01:11:08 -04:00
Mark Ellzey
d76b23110f Merge pull request #239 from ellzey/issue237
Call underlying bev ctrl SET_FD on filtered bufferevents
2015-05-13 01:10:42 -04:00
Mark Ellzey
80faee9fbb Update README.md 2015-05-13 00:52:40 -04:00
Mark Ellzey
ad4a897a76 Update README.md 2015-05-13 00:51:07 -04:00
Mark Ellzey
a2b2e1e6f7 Update README.md 2015-05-13 00:49:08 -04:00
Mark Ellzey
37453aba99 Update travis config for status updates 2015-05-12 15:43:03 -04:00
Mark Ellzey
0dfa5dc671 Update README.md 2015-05-12 15:33:26 -04:00
Mark Ellzey
1cc2e2953e Use autotools for appveyor until cmake is fixed. 2015-05-12 04:37:42 -04:00
Mark Ellzey
e84e269b47 Commented out a WIN32 threading / timing test for now
- seems as if windows has some time scale issues which I am looking
  into. For now I am commenting out the regression test until it is
  fixed.
2015-05-11 22:53:05 -04:00
Mark Ellzey
c4d440bf95 Merge branch 'master' into 21_size_and_misc_fixes 2015-05-11 22:18:54 -04:00
Mark Ellzey
37bb3f9f66 Merge pull request #241 from ellzey/21_fix_appveyor_ssl_link
Fix download link for appveyor SSL
2015-05-11 16:27:15 -04:00
Mark Ellzey
107d565df4 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
2015-05-11 13:55:32 -04:00
Mark Ellzey
d9f6140b6b Merge branch 'master' into issue237 2015-05-11 12:34:30 -04:00
Mark Ellzey
043ae7481f 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.
2015-05-11 12:06:01 -04:00
Mark Ellzey
f1b3a1e007 Merge pull request #242 from ellzey/pullRequest118
expose bufferevent_incref/decref (with fewer modifications)
2015-05-09 02:44:13 -04:00
Mark Ellzey
1ed6718d1d expose bufferevent_incref/decref (with fewer modifications) 2015-05-06 14:56:31 -07:00
Mark Ellzey
c2aa7dcb70 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
2015-05-05 10:37:00 -07:00
Mark Ellzey
a695a720cd Fix potential fd leak in listener_read_cb()
As pointed out by harlan_ in #libevent after running a coverity sweep.
If the listener is free'd, 'new_fd' is never closed.
2015-04-27 22:43:04 -04:00
Greg Hazel
6e7a580c15 tab 2015-03-24 17:45:52 -07:00
Greg Hazel
38cef641c4 fix the return value of event_deferred_cb_schedule_ 2015-03-24 17:29:40 -07:00
Nick Mathewson
31c6d45f8d Merge pull request #220 from miniupnp/fix_warnings
Fix warnings
2015-02-17 12:37:30 -05:00
Thomas Bernard
0c7f21781a Fix mixed declarations and code (forbidden by ISO C90) 2015-02-16 23:42:54 +01:00
Thomas Bernard
746d2c502c Fix "function declaration isn’t a prototype"
add "void" to argument list
2015-02-16 23:41:53 +01:00
Nick Mathewson
d59113a443 Merge pull request #214 from JoakimSoderberg/appveyor
Forgot to install OpenSSL for appveyor
2015-02-05 15:24:55 -05:00
Joakim Söderberg
26164a560d Forgot to install OpenSSL for appveyor 2015-02-05 20:56:10 +01:00
Nick Mathewson
874ea871f7 Merge pull request #117 from JoakimSoderberg/appveyor
Add support for appveyor.com windows CI
2015-02-05 13:37:24 -05:00
Joakim Söderberg
5f89c37e00 Add support for appveyor.com windows CI
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**
2015-02-05 19:24:19 +01:00
Nick Mathewson
deca354cba Merge pull request #116 from JoakimSoderberg/fix_build_tree_cmake_config
This fixes a bug introduced in 27bd9faf498b91923296cc91643e03ec4055c230
2015-02-05 12:14:16 -05:00
Joakim Söderberg
19ba454317 This fixes a bug introduced in 27bd9faf498b91923296cc91643e03ec4055c230
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).

27bd9faf498b91923296cc91643e03ec4055c230 changed this behavior so that both configs would point to the system wide path `/usr/local/include`

This meant that projects just wanting to import directly for the build tree would fail.
2015-02-05 17:34:50 +01:00
Nick Mathewson
a77a82a03f Merge remote-tracking branch 'azat/be-pair-fix-freeing-shared-lock-v5' 2015-02-04 08:37:32 -05:00
Nick Mathewson
51821e20b2 Merge pull request #207 from azat/avoid-leaking-of-event_debug_map_HT_GROW
Avoid leaking of event_debug_map_HT_GROW
2015-02-04 08:33:42 -05:00
Nick Mathewson
4472ec68e6 Merge pull request #212 from xbao/master
changed strtotimeval signature to avoid conflict with Android NDK sys/time.h header (#211)
2015-02-03 15:57:31 -05:00
Nick Mathewson
1cae3ae167 Merge remote-tracking branch 'public/master' 2015-02-02 13:57:50 -05:00
Nick Mathewson
537177d315 New function to get address for nameserver. 2015-02-02 13:57:22 -05:00
Xiao Bao Clark
bdbc823f7e changed strtotimeval signature as per #211 2015-01-28 17:17:02 +11:00
Nick Mathewson
62eaa889cc Merge pull request #210 from mc-server/master
Added cmake-generated files to ignore list.
2015-01-27 10:07:22 -05:00
Matyas Dolak
6c12bfec1d Added cmake-generated files to ignore list.
These are generated by cmake on Windows with MSVC.
2015-01-27 15:30:52 +01:00
Azat Khuzhin
a558fcdb43 be_pair/regress: cover use of shared lock (lock/unlock/free)
For more info look at 92a359ee3adf4636db508e6c6d7179d4d59eaafc
("be_pair: release shared lock with the latest of bufferevent_pair")
2015-01-26 00:40:09 +03:00
Azat Khuzhin
e5c87d18b0 event_free_debug_globals_locks(): disable lock debugging
This will allow to use library event after
event_free_debug_globals_locks()/libevent_global_shutdown() without
invalid read/write's.
2015-01-26 00:40:09 +03:00
Azat Khuzhin
ccc55937cf evthread: evthreadimpl_disable_lock_debugging_() for libevent_global_shutdown() 2015-01-26 00:40:09 +03:00
Azat Khuzhin
c0b34f6fd5 evthread: add evthread_get_{lock,condition}_callbacks() helpers 2015-01-26 00:40:09 +03:00
Azat Khuzhin
92a359ee3a be_pair: release shared lock with the latest of bufferevent_pair
Then next code sample will use free'd lock:
  evthread_use_pthreads();
  ...
  assert(!bufferevent_pair_new(base, BEV_OPT_THREADSAFE, pair));
  ...
  bufferevent_free(pair[0]); # refcnt == 0 -> unlink
  bufferevent_free(pair[1]); # refcnt == 0 -> unlink
  ...
  event_base_free() -> finalizers -> EVTHREAD_FREE_LOCK(bev1->lock)
                                  -> BEV_LOCK(bev2->lock) <-- *already freed*

While if you will reverse the order:
  bufferevent_free(pair[1]); # refcnt == 0 -> unlink
  bufferevent_free(pair[0]); # refcnt == 0 -> unlink
  ...
  event_base_free() -> finalizers -> BEV_LOCK(bev2->lock)/!own_lock/BEV_UNLOCK(bev2->lock)
                                  -> EVTHREAD_FREE_LOCK(bev1->lock) (own_lock)

It is ok now, but I guess that it will be better to relax order of
freeing pairs.
2015-01-26 00:40:02 +03:00
Nick Mathewson
4d66552a47 Merge pull request #115 from jer-gentoo/master
EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD
2015-01-22 12:15:01 -05:00
jer-gentoo
8674e4fb0a EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD
Looks like EVBUFFER_PTR_ADD should have been used instead of EVBUFFER_PTR_SET.
2015-01-21 11:24:23 +01:00
Azat Khuzhin
3540a193b5 regress_dns: drop hack for event_debug_map_HT_GROW in leak tests 2015-01-08 04:51:27 +03:00
Azat Khuzhin
941faaed39 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().
2015-01-08 04:49:28 +03:00
Azat Khuzhin
597c7b259b ht-internal: don't reset hth_table_length explicitly in name_##HT_CLEAR
name_##HT_CLEAR calls name_##HT_INIT that reset hth_table_length to 0.
2015-01-08 04:43:37 +03:00