1152 Commits

Author SHA1 Message Date
Niels Provos
8e8d94a3e0 Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
svn:r1436
2009-09-24 22:18:19 +00:00
Nick Mathewson
18fe400805 Forward-port: fix android compilation
svn:r1435
2009-09-23 23:51:26 +00:00
Nick Mathewson
2622e5ace2 Fix the assert I added to epoll.c: spotted by Dmitry Novikov
svn:r1432
2009-09-16 17:17:57 +00:00
Nick Mathewson
c2ead9f173 Treat events with fd == -1 as addable.
This turns out to simplify a fair bit of logic, including the bufferevent
code, and should fix bug 2850656.

svn:r1431
2009-09-11 21:02:19 +00:00
Nick Mathewson
85255a6397 Make epoll use less RAM.
We do this by not allocating the maximum epoll_event array for the epoll
backend at startup.  Instead, we start out accepting 32 events at a time, and
double the array's size when it seems that the OS is generating events faster
than we're requesting them.  This saves up to 374K per epoll-based
event_base.  Resolves bug 2839240.

svn:r1428
2009-09-11 18:47:35 +00:00
Nick Mathewson
e3f89fa275 Add a trivial race-fix from Chromium: do not try to re-detect whether we have a monotonic clock every time we make a new event_base.
svn:r1427
2009-09-11 18:21:57 +00:00
Nick Mathewson
3b461a6d03 Treat a negative number of bytes to read as the kernel saying "I don't know."
svn:r1426
2009-09-11 18:21:37 +00:00
Nick Mathewson
f65b8b0964 On connect, call only one of BEV_EVENT_CONNECTED or writecb.
Previously, if we had a socket bufferevent in connect state, we'd send
both of these to indicate that the connection was done.  That was broken
since the point of adding BEV_EVENT_CONNECTED was so that we could
distinguish "we're connected" and "we wrote something".

Now, writecb is called only when
   A) the connection finished but the user never put the socket into a
      "connecting" state, or
   B) data was actually written.

svn:r1425
2009-08-19 20:55:25 +00:00
Nick Mathewson
2c1b0e4428 Fix build warnings and add changelog entry for evhttp patches.
svn:r1424
2009-08-16 19:22:15 +00:00
Nick Mathewson
c8b0fe4ad7 Define evhttp_del_accept_socket
[Patch from David Reiss]

svn:r1423
2009-08-16 19:22:10 +00:00
Nick Mathewson
6c53334c65 Define evhttp_{bind,accept}_socket_with_handle
[Patch from David Reiss]

svn:r1422
2009-08-16 19:22:04 +00:00
Nick Mathewson
4bcd5646d8 Make evhttp_bound_socket visible, and provide an accessor to its fd
Declare the previously private struct evhttp_bound_socket in
event2/http.h as an opaque struct.

Implement evhttp_bound_socket_get_fd, which returns the file descriptor
of an evhttp_bound_socket.

[Patch from David Reiss]

svn:r1421
2009-08-16 19:21:57 +00:00
Nick Mathewson
0755833e84 Minor documentation fixes
[Patch from David Reiss]

svn:r1420
2009-08-16 19:21:50 +00:00
Nick Mathewson
22bd5b4287 Support sendfile on solaris: patch from Caitlin Mercer.
svn:r1419
2009-08-16 16:40:42 +00:00
Nick Mathewson
f22823982f New function to put an SSL bufferevent into a renegotiating state.
svn:r1418
2009-08-14 20:07:35 +00:00
Nick Mathewson
46a61869ca Disable whichever struct event we don't want during ssl handshaking.
svn:r1417
2009-08-14 20:07:17 +00:00
Nick Mathewson
58b0708e18 Only send a connected event _after_ we've adjusted the SSL state.
This is important if the callback adjusts it to something else.

svn:r1416
2009-08-14 20:07:09 +00:00
Nick Mathewson
d17c720c05 Remove an extraneous puts().
svn:r1415
2009-08-14 20:07:01 +00:00
Nick Mathewson
eff09a299c tab/whitespace fixes in bufferevent_sock.c
Also note that write() doesn't usually say 0.

svn:r1414
2009-08-14 20:06:48 +00:00
Nick Mathewson
bd26bace0d When running with deferred callbacks, always send the "connected" event
before any read/write events, and send timeout/error/eof events after.

svn:r1413
2009-08-11 19:47:46 +00:00
Nick Mathewson
7a55c48d77 Add a few missing changelog entries
svn:r1412
2009-08-09 20:18:00 +00:00
Nick Mathewson
800f9aa607 When bufferevent_socket_connect is called with no address, assume that our existing fd is connecting and put the connection into "connecting" mode.
svn:r1411
2009-08-09 20:17:29 +00:00
Nick Mathewson
8a99083f01 Add an evbuffer_search_range() to search a bounded range of a buffer
This can be handy when you have	one search to find the end of a	header
section, and then you want to find a substring within the header
section without looking at the body.

svn:r1410
2009-08-07 17:16:52 +00:00
Nick Mathewson
0c09fe5ada Add a couple more evdns tests. Libevent is now, for me, at 80.02% coverage.
svn:r1409
2009-08-03 20:50:56 +00:00
Nick Mathewson
94e8f9b901 Another DNS unit tests, to handle reissues.
The evdns module is now up to ~72% coverage; Libevent is up to nearly 80%.

svn:r1408
2009-08-03 20:15:45 +00:00
Nick Mathewson
dc1f5b1ee0 why say fprintf(stdout, X) when you can say printf?
svn:r1407
2009-08-03 20:15:39 +00:00
Nick Mathewson
213dc2a2ef Fix an annoying evdns crash bug, and add more unit tests for evdns.
svn:r1406
2009-08-03 20:15:32 +00:00
Nick Mathewson
a5006d80cd Unit tests for DNS search.
svn:r1405
2009-08-03 16:15:57 +00:00
Nick Mathewson
d41347722a Refactor evbuffer_readln() into a search-for-eol function and an extract-line function.
svn:r1404
2009-07-31 17:35:42 +00:00
Nick Mathewson
a26d2d1b87 Refactor evbuffer_readln to use evbuffer_ptr; remove old evbuffer_iterator.
svn:r1403
2009-07-31 17:34:47 +00:00
Nick Mathewson
6dc488bd7e Improved coverage for evbuffer_readln()
svn:r1402
2009-07-31 17:34:18 +00:00
Nick Mathewson
7c688dd9a2 New function to expose bufferevent.enabled
svn:r1401
2009-07-31 14:41:45 +00:00
Nick Mathewson
621aafd27a Export sockaddr comparison functionality.
svn:r1400
2009-07-30 22:11:23 +00:00
Nick Mathewson
cf54d74a65 More unit tests for Openssl, including initializing with no socket. Up to 75% coverage.
svn:r1399
2009-07-30 20:41:41 +00:00
Nick Mathewson
d1a2254bf2 Fix some bugs in bufferevent_socket_connect
svn:r1398
2009-07-30 20:41:31 +00:00
Nick Mathewson
7a2a51a3a1 Add unit tests for SSL session renegotiation.
This tickles the write-blocked-on-read code, and in this case turned
up a bug in it.

svn:r1397
2009-07-30 20:41:21 +00:00
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