1116 Commits

Author SHA1 Message Date
Nick Mathewson
595f7e3877 Always retry SSL_write() with the same number you told it last time.
svn:r1396
2009-07-30 20:41:12 +00:00
Nick Mathewson
eecefc50e7 Add a function to extract the SSL object from a bufferevent_openssl.
svn:r1395
2009-07-30 20:41:00 +00:00
Nick Mathewson
d5a3f1f116 Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag, and explain why.
svn:r1394
2009-07-30 20:40:50 +00:00
Nick Mathewson
44715517e8 Use SSL_do_handshake in place of SSL_connect/SSL_accept
svn:r1393
2009-07-30 20:40:40 +00:00
Nick Mathewson
8a3007efb9 More evconnlistener unit tests: bump its coverage from 71% to 83%.
svn:r1392
2009-07-30 17:01:38 +00:00
Nick Mathewson
7c20a6ae52 Export an ev_socklen_t.
svn:r1391
2009-07-30 17:01:21 +00:00
Nick Mathewson
75fe762e03 Accessor function to get a listener's associated fd
svn:r1390
2009-07-30 17:00:56 +00:00
Nick Mathewson
625116295a Add unit test for parsing addresses with bad ports.
svn:r1389
2009-07-30 17:00:46 +00:00
Nick Mathewson
3c99c79df9 Changelog entry for msvc fixes.
svn:r1388
2009-07-28 19:45:54 +00:00
Nick Mathewson
72ea534f8e Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
2009-07-28 19:41:57 +00:00
Nick Mathewson
a826a75800 Some tweaks to Brodie Thesfield's MSVC patch.
svn:r1386
2009-07-28 19:41:48 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
12199fa7a5 Fix segfault during failed allocatino of locked evdns base.
We need to comb the rest of the code to make sure that we don't blindly wrap
functions in LOCK(x), UNLOCK(x) when those functions might contain a FREE(x)
in the middle.

Rocco Carbone found and reported this bug.

svn:r1384
2009-07-28 17:11:03 +00:00
Nick Mathewson
f8b527e6a1 Fix a dumb bug where we would allocate too little memory in event_get_supported_methods().
svn:r1383
2009-07-28 05:09:06 +00:00
Nick Mathewson
709c21c48c Bufferevent support for openssl.
This code adds a new Bufferevent type that is only compiled when the
openssl library is present.  It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.

There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better.  Sometimes events are
generated needlessly: this will hose performance.

There's a new encrypting proxy in sample/le-proxy.c.

This code has only been tested on OSX, and nowhere else.

svn:r1382
2009-07-28 04:03:57 +00:00
Nick Mathewson
b06b2649b4 Make "deferred callback queue" independent of event_base.
This way, we can more easily have an IOCP bufferevent implementation
that does not need an event_base at all.  Woot.

svn:r1381
2009-07-26 01:29:39 +00:00
Nick Mathewson
8cc6883524 Fix the main/methods unit test to pass from "make verify".
The problem was introduced when we changed the semantics of
get_supported_methods() to reflect all the methods that exist.
Previously, it had not returned methods disabled from the environment,
but the test didn't know that.

svn:r1379
2009-07-25 03:35:32 +00:00
Niels Provos
6fbeb9237c call it 2.0.2-alpha
svn:r1378
2009-07-25 03:23:46 +00:00
Nick Mathewson
8eb155a1c0 Fix build on platforms (like Solaris 10, reportedly) which lack a MAP_FILE.
svn:r1375
2009-07-23 14:48:24 +00:00
Nick Mathewson
49de08ef35 Push coverage of event.c a little higher
svn:r1373
2009-07-21 19:20:44 +00:00
Nick Mathewson
59e8e959dc Add clarifying "static" to definitions of fns in event.c
svn:r1372
2009-07-21 19:20:25 +00:00
Nick Mathewson
670658ebd7 Correct the signatures for evdns_configure_windows_nameservers(), now that it is exposed.
svn:r1369
2009-07-21 18:32:57 +00:00
Nick Mathewson
f4775918cd Refactor evtag tests into their own suite.
svn:r1366
2009-07-20 14:55:51 +00:00
Nick Mathewson
e8400a43ca Rename encode_int(64) to avoid polluting the global namespace.
They're now called evtag_encode_int(64).  The old names are available
as macros in event2/tag_compat.h.

Also, add unit tests for encode/decode_int64.

svn:r1365
2009-07-20 14:55:35 +00:00
Nick Mathewson
dc031990e0 Add strcasecmp tests to improve evutil coverage a bit
svn:r1364
2009-07-20 14:55:07 +00:00
Nick Mathewson
1fb2e818a6 Use a uniform strategy when a function is not working: do not expose
it.

Rather than failing at runtime, it is better to fail at compile or
link time.

svn:r1363
2009-07-17 21:47:45 +00:00
Nick Mathewson
9cf4ee7e17 Fix a simple warning
svn:r1362
2009-07-17 21:47:35 +00:00
Nick Mathewson
d3bef1a1e3 Finish implementing new convention that whenever an optional function is declared, a corresponding macro is defined.
svn:r1361
2009-07-17 20:32:25 +00:00
Nick Mathewson
a386fde321 Checking for MS_WINDOWS rather than WIN32 is a Tor-ism. Fix that!
svn:r1360
2009-07-17 20:28:03 +00:00
Nick Mathewson
c02b305ae5 Trivial tests to exercise deferred and locking bufferevent code.
These are done as variations of test_bufferevent_connect, since that
one exercises event callbacks as well as read/write callbacks.

The coverage for bufferevent.c is now up to about 87%, from about 70%.

svn:r1358
2009-07-17 20:23:12 +00:00
Nick Mathewson
61f2a45de1 Add a tinytest flag to initialize threading.
svn:r1357
2009-07-17 20:23:05 +00:00
Nick Mathewson
4ba6eda48f Make evthread_use_pthreads() actually return 0 on success.
svn:r1356
2009-07-17 20:22:56 +00:00
Nick Mathewson
ed038295cd Define a macro to indicate that we have defined one of the optional evthread_use macros
svn:r1355
2009-07-17 20:22:48 +00:00
Nick Mathewson
69601fc2f6 Update event_tv when time jumps backwards, so that we only note each jump once. Fix for 1939984
svn:r1353
2009-07-17 18:59:22 +00:00
Nick Mathewson
9c2ecba7f8 Oops. -1 is an integer, not a pointer.
svn:r1352
2009-07-17 18:42:12 +00:00
Nick Mathewson
d6f2e19924 Unit tests for bufferevent_get(fd|_underlying)
svn:r1351
2009-07-17 18:38:46 +00:00
Nick Mathewson
5d71b25b51 Remove all trailing whitespace from end-of-line.
svn:r1350
2009-07-17 18:38:38 +00:00
Nick Mathewson
d4e3671fb4 Add a test to free_active_base to free a base with an active event.
svn:r1349
2009-07-17 18:38:21 +00:00
Nick Mathewson
638116cacd Add a check for event_add failure to evthread_make_base_notifiable()
svn:r1348
2009-07-17 18:38:14 +00:00
Nick Mathewson
a62283a9c3 Always hold a reference to a bufferevent when calling its callbacks.
Rationale: we hold a lock on the bufferevent when its callbacks are
executing, so we need to release the lock afterwards.  But the
callback might free the bufferevent, so unless we're holding a
reference on the bufferevent, the lock might not be there for us to
release.

svn:r1347
2009-07-17 17:46:17 +00:00
Nick Mathewson
e83a32dfe1 Do not define _FORTIFY_SOURCE if the platform GCC already defined it for us.
svn:r1346
2009-07-14 19:31:20 +00:00
Nick Mathewson
9fcd84d196 Include disabled methods in event_get_supported_methods() output.
Previously, events that were disabled using EVENT_NO* were left out of
event_get_supported_methods().  This was wrong, broke unit tests
(under some circumstances) and left the user with no good way to tell
which methods were actually compiled in.

Fixes bug 2821015.

svn:r1344
2009-07-14 19:19:45 +00:00
Nick Mathewson
043515bc52 Stop using C++ style comments.
svn:r1343
2009-07-14 18:50:06 +00:00
Nick Mathewson
e224321c64 Convert and expand free_active_base/event_base_new tests to avoid dbl-free. Patch from Zack Weinberg
svn:r1342
2009-07-14 18:49:42 +00:00
Nick Mathewson
6b4b77a265 Make event_del(E) block while E is running in another thread.
This gives you the property that once you have called event_del(E),
you know that E is no longer running or pending or active at all, and
so it is safe to delete the resource used by E's callback.

svn:r1341
2009-07-14 16:54:48 +00:00
Nick Mathewson
d866f05585 Patch from Zack Weinberg: normalize perror() tt functions and add tt_fail/tt_abort_printf
svn:r1340
2009-07-13 20:03:00 +00:00
Nick Mathewson
0cc10e419c Use -version-info, not -release.
Patch from Zack Weinberg.  His description:

This one might be a little more controversial. Libtool's -release and
-version-info options are supposed to be mutually exclusive, but it doesn't
either enforce that or make it sufficiently clear in the manual. Using
both makes the -version-info switch ineffective; you will get sonames like
"libevent-2.0.so.1", "libevent-2.1.so.1", etc., even though version 2.1
will presumably be backward ABI compatible with 2.0.

This patch just takes out the -release switches and bumps the -version-info
value to 2:0:0 so that people looking at the files in /usr/lib will not be
confused (it'll be "libevent.so.2"). This does change the soname, but the
current release is labeled an alpha, and it would be better to stop using
both switches as soon as possible, before someone over at libtool
headquarters decides to enforce the mutual exclusivity here...

Note that libevent_pthreads is not being linked with any versioning
switches I didn't change that because I wasn't sure whether it was
intentional.

svn:r1339
2009-07-13 20:02:49 +00:00
Nick Mathewson
d3a8ccb807 Change use of AC_CHECK_LIB to AC_SEARCH_LIBS.
Patch from Zack Weinberg.  His message:

  This one eliminates all use of AC_CHECK_LIB in the configure script.
  AC_CHECK_LIB has a serious flaw: if the library you mention *exists*
  but is not *necessary* for the function you want, it adds it to
  $(LIBS) anyway.  This was fine in the days of static libraries,
  because the linker would ignore an .a library that didn't contain
  anything you needed. However, ELF shared libraries are different
  (let's not get into why): the linker will by default record a
  DT_NEEDED entry for every shared object mentioned on the link
  command line. Thus, every use of AC_CHECK_LIB is a potential
  unnecessary DT_NEEDED, making extra work for the dynamic loader. The
  cure is simply to use AC_SEARCH_LIBS instead; it first tries to find
  the function you ask for in libc, and only if that doesn't work does
  it try to use the extra library you mention.

  For the same reasons, pkg-config .pc files should distinguish
  between the libraries to use for shared linkage (Libs:) and the
  additional libraries needed for static linkage (Libs.private:). I
  have also made that correction in this patch. I also took the
  opportunity to clean up the substitution variables a little and make
  absolutely sure that the core library does not get linked against
  zlib.

svn:r1338
2009-07-10 19:38:16 +00:00
Nick Mathewson
a501d6833b Add a lock/unlock pair inside the event callbacks in bufferevents.
This fixes part of bug 2800642, I believe, though there is still a
general race condition in multithreaded use of events that we need to
think about.

svn:r1337
2009-07-10 19:34:00 +00:00
Niels Provos
6469598e56 Allow C identifiers as struct names; allow multiple comments in .rpc files; from Zack Weinberg; plus a tiny tweak
svn:r1336
2009-07-03 17:43:26 +00:00