Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
	evthread.c
This commit is contained in:
Nick Mathewson 2011-04-22 23:46:25 -04:00
commit 614a1712b7
13 changed files with 48 additions and 10 deletions

View File

@ -430,6 +430,7 @@ be_filter_readcb(struct bufferevent *underlying, void *_me)
/* XXXX use return value */
res = be_filter_process_input(bevf, state, &processed_any);
(void)res;
/* XXX This should be in process_input, not here. There are
* other places that can call process-input, and they should

View File

@ -1014,6 +1014,7 @@ be_openssl_outbuf_cb(struct evbuffer *buf,
consider_writing(bev_ssl);
}
/* XXX Handle r < 0 */
(void)r;
}

View File

@ -452,6 +452,7 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
/* XXX use the other addrinfos? */
/* XXX use this return value */
r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
(void)r;
_bufferevent_decref_and_unlock(bev);
evutil_freeaddrinfo(ai);
}

View File

@ -646,6 +646,16 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then
#error
#endif])], have_gcc45=yes, have_gcc45=no)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
#if !defined(__clang__)
#error
#endif])], have_clang=yes, have_clang=no)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
#if !defined(__clang__) || (__clang_major__ > 2) || (__clang_major__ == 2 && __clang_minor__ > 9)
#error
#endif])], have_clang29orlower=yes, have_clang29orlower=no)
CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror"
CFLAGS="$CFLAGS -Wno-unused-parameter -Wstrict-aliasing"
@ -657,13 +667,27 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then
if test x$have_gcc42 = xyes ; then
# These warnings break gcc 4.0.2 and work on gcc 4.2
CFLAGS="$CFLAGS -Waddress -Wnormalized=id -Woverride-init"
CFLAGS="$CFLAGS -Waddress"
fi
if test x$have_gcc42 = xyes && test x$have_clang29orlower = xno; then
# These warnings break gcc 4.0.2 and clang, but work on gcc 4.2
# We only disable these for clang 2.9 and lower, in case they are
# supported in later versions.
CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init"
fi
if test x$have_gcc45 = xyes ; then
# These warnings work on gcc 4.5
CFLAGS="$CFLAGS -Wlogical-op"
fi
if test x$have_clang = xyes; then
# Disable the unused-function warnings, because these trigger
# for minheap-internal.h related code.
CFLAGS="$CFLAGS -Wno-unused-function"
fi
##This will break the world on some 64-bit architectures
# CFLAGS="$CFLAGS -Winline"

View File

@ -2701,10 +2701,13 @@ evdns_cancel_request(struct evdns_base *base, struct evdns_request *handle)
{
struct request *req;
if (!handle->current_req)
return;
if (!base) {
/* This redundancy is silly; can we fix it? (Not for 2.0) XXXX */
base = handle->base;
if (!base && handle->current_req)
if (!base)
base = handle->current_req->base;
}

View File

@ -228,6 +228,7 @@ debug_cond_wait(void *_cond, void *_lock, const struct timeval *tv)
{
int r;
struct debug_lock *lock = _lock;
EVUTIL_ASSERT(lock);
EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
EVLOCK_ASSERT_LOCKED(_lock);
evthread_debug_lock_mark_unlocked(0, lock);

3
http.c
View File

@ -1775,7 +1775,8 @@ evhttp_parse_headers(struct evhttp_request *req, struct evbuffer* buffer)
}
if (status == MORE_DATA_EXPECTED) {
if (req->headers_size + evbuffer_get_length(buffer) > req->evcon->max_headers_size)
if (req->evcon != NULL &&
req->headers_size + evbuffer_get_length(buffer) > req->evcon->max_headers_size)
return (DATA_TOO_LONG);
}

View File

@ -72,7 +72,6 @@ static void
gai_callback(int err, struct evutil_addrinfo *ai, void *arg)
{
const char *name = arg;
struct evutil_addrinfo *ai_first = NULL;
int i;
if (err) {
printf("%s: %s\n", name, evutil_gai_strerror(err));
@ -95,8 +94,6 @@ gai_callback(int err, struct evutil_addrinfo *ai, void *arg)
printf("[%d] %s: %s\n",i,name,buf);
}
}
if (ai_first)
evutil_freeaddrinfo(ai_first);
}
static void
@ -120,6 +117,8 @@ evdns_server_callback(struct evdns_server_request *req, void *data)
printf(" -- replying for %s (PTR)\n", req->questions[i]->name);
r = evdns_server_request_add_ptr_reply(req, NULL, req->questions[i]->name,
"foo.bar.example.com", 10);
if (r<0)
printf("ugh, no luck");
} else {
printf(" -- skipping %s [%d %d]\n", req->questions[i]->name,
req->questions[i]->type, req->questions[i]->dns_question_class);

View File

@ -36,6 +36,7 @@
# endif
#endif
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "event2/event.h"
@ -130,6 +131,8 @@ launch_request(void)
struct request_info *ri;
memset(&sin, 0, sizeof(sin));
++total_n_launched;
sin.sin_family = AF_INET;

View File

@ -1296,7 +1296,9 @@ test_evbuffer_callbacks(void *ptr)
evbuffer_drain(buf_out2, evbuffer_get_length(buf_out2));
/* Let's test the obsolete buffer_setcb function too. */
cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
tt_assert(cb1 != NULL);
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
tt_assert(cb2 != NULL);
evbuffer_setcb(buf, self_draining_callback, NULL);
evbuffer_add_printf(buf, "This should get drained right away.");
tt_uint_op(evbuffer_get_length(buf), ==, 0);

View File

@ -1626,10 +1626,9 @@ gaic_launch(struct event_base *base, struct evdns_base *dns_base)
}
static void
test_getaddrinfo_async_cancel_stress(void *arg)
test_getaddrinfo_async_cancel_stress(void *ptr)
{
struct basic_test_data *data = arg;
struct event_base *base = data->base;
struct event_base *base;
struct evdns_base *dns_base = NULL;
struct evdns_server_port *server = NULL;
evutil_socket_t fd = -1;
@ -1701,7 +1700,7 @@ struct testcase_t dns_testcases[] = {
{ "getaddrinfo_async", test_getaddrinfo_async,
TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"" },
{ "getaddrinfo_cancel_stress", test_getaddrinfo_async_cancel_stress,
TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"" },
TT_FORK, NULL, NULL },
END_OF_TESTCASES
};

View File

@ -570,6 +570,8 @@ http_bad_request_test(void *arg)
/* real NULL request */
http_request = "";
bufferevent_write(bev, http_request, strlen(http_request));
shutdown(fd, SHUT_WR);
timerclear(&tv);
tv.tv_usec = 10000;

View File

@ -276,6 +276,7 @@ test_bufferevent_zlib(void *arg)
tt_int_op(r, ==, Z_OK);
memset(&z_input, 0, sizeof(z_input));
r = inflateInit(&z_input);
tt_int_op(r, ==, Z_OK);
/* initialize filters */
bev1 = bufferevent_filter_new(bev1, NULL, zlib_output_filter,