mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
Merge remote-tracking branch 'origin/patches-2.0'
Conflicts: evthread.c
This commit is contained in:
commit
614a1712b7
@ -430,6 +430,7 @@ be_filter_readcb(struct bufferevent *underlying, void *_me)
|
|||||||
|
|
||||||
/* XXXX use return value */
|
/* XXXX use return value */
|
||||||
res = be_filter_process_input(bevf, state, &processed_any);
|
res = be_filter_process_input(bevf, state, &processed_any);
|
||||||
|
(void)res;
|
||||||
|
|
||||||
/* XXX This should be in process_input, not here. There are
|
/* XXX This should be in process_input, not here. There are
|
||||||
* other places that can call process-input, and they should
|
* other places that can call process-input, and they should
|
||||||
|
@ -1014,6 +1014,7 @@ be_openssl_outbuf_cb(struct evbuffer *buf,
|
|||||||
consider_writing(bev_ssl);
|
consider_writing(bev_ssl);
|
||||||
}
|
}
|
||||||
/* XXX Handle r < 0 */
|
/* XXX Handle r < 0 */
|
||||||
|
(void)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -452,6 +452,7 @@ bufferevent_connect_getaddrinfo_cb(int result, struct evutil_addrinfo *ai,
|
|||||||
/* XXX use the other addrinfos? */
|
/* XXX use the other addrinfos? */
|
||||||
/* XXX use this return value */
|
/* XXX use this return value */
|
||||||
r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
|
r = bufferevent_socket_connect(bev, ai->ai_addr, (int)ai->ai_addrlen);
|
||||||
|
(void)r;
|
||||||
_bufferevent_decref_and_unlock(bev);
|
_bufferevent_decref_and_unlock(bev);
|
||||||
evutil_freeaddrinfo(ai);
|
evutil_freeaddrinfo(ai);
|
||||||
}
|
}
|
||||||
|
26
configure.in
26
configure.in
@ -646,6 +646,16 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then
|
|||||||
#error
|
#error
|
||||||
#endif])], have_gcc45=yes, have_gcc45=no)
|
#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 -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"
|
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
|
if test x$have_gcc42 = xyes ; then
|
||||||
# These warnings break gcc 4.0.2 and work on gcc 4.2
|
# 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
|
fi
|
||||||
|
|
||||||
if test x$have_gcc45 = xyes ; then
|
if test x$have_gcc45 = xyes ; then
|
||||||
# These warnings work on gcc 4.5
|
# These warnings work on gcc 4.5
|
||||||
CFLAGS="$CFLAGS -Wlogical-op"
|
CFLAGS="$CFLAGS -Wlogical-op"
|
||||||
fi
|
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
|
##This will break the world on some 64-bit architectures
|
||||||
# CFLAGS="$CFLAGS -Winline"
|
# CFLAGS="$CFLAGS -Winline"
|
||||||
|
|
||||||
|
5
evdns.c
5
evdns.c
@ -2701,10 +2701,13 @@ evdns_cancel_request(struct evdns_base *base, struct evdns_request *handle)
|
|||||||
{
|
{
|
||||||
struct request *req;
|
struct request *req;
|
||||||
|
|
||||||
|
if (!handle->current_req)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!base) {
|
if (!base) {
|
||||||
/* This redundancy is silly; can we fix it? (Not for 2.0) XXXX */
|
/* This redundancy is silly; can we fix it? (Not for 2.0) XXXX */
|
||||||
base = handle->base;
|
base = handle->base;
|
||||||
if (!base && handle->current_req)
|
if (!base)
|
||||||
base = handle->current_req->base;
|
base = handle->current_req->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +228,7 @@ debug_cond_wait(void *_cond, void *_lock, const struct timeval *tv)
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct debug_lock *lock = _lock;
|
struct debug_lock *lock = _lock;
|
||||||
|
EVUTIL_ASSERT(lock);
|
||||||
EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
|
EVUTIL_ASSERT(DEBUG_LOCK_SIG == lock->signature);
|
||||||
EVLOCK_ASSERT_LOCKED(_lock);
|
EVLOCK_ASSERT_LOCKED(_lock);
|
||||||
evthread_debug_lock_mark_unlocked(0, lock);
|
evthread_debug_lock_mark_unlocked(0, lock);
|
||||||
|
3
http.c
3
http.c
@ -1775,7 +1775,8 @@ evhttp_parse_headers(struct evhttp_request *req, struct evbuffer* buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == MORE_DATA_EXPECTED) {
|
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);
|
return (DATA_TOO_LONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ static void
|
|||||||
gai_callback(int err, struct evutil_addrinfo *ai, void *arg)
|
gai_callback(int err, struct evutil_addrinfo *ai, void *arg)
|
||||||
{
|
{
|
||||||
const char *name = arg;
|
const char *name = arg;
|
||||||
struct evutil_addrinfo *ai_first = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
if (err) {
|
if (err) {
|
||||||
printf("%s: %s\n", name, evutil_gai_strerror(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);
|
printf("[%d] %s: %s\n",i,name,buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ai_first)
|
|
||||||
evutil_freeaddrinfo(ai_first);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
printf(" -- replying for %s (PTR)\n", req->questions[i]->name);
|
||||||
r = evdns_server_request_add_ptr_reply(req, NULL, req->questions[i]->name,
|
r = evdns_server_request_add_ptr_reply(req, NULL, req->questions[i]->name,
|
||||||
"foo.bar.example.com", 10);
|
"foo.bar.example.com", 10);
|
||||||
|
if (r<0)
|
||||||
|
printf("ugh, no luck");
|
||||||
} else {
|
} else {
|
||||||
printf(" -- skipping %s [%d %d]\n", req->questions[i]->name,
|
printf(" -- skipping %s [%d %d]\n", req->questions[i]->name,
|
||||||
req->questions[i]->type, req->questions[i]->dns_question_class);
|
req->questions[i]->type, req->questions[i]->dns_question_class);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "event2/event.h"
|
#include "event2/event.h"
|
||||||
@ -130,6 +131,8 @@ launch_request(void)
|
|||||||
|
|
||||||
struct request_info *ri;
|
struct request_info *ri;
|
||||||
|
|
||||||
|
memset(&sin, 0, sizeof(sin));
|
||||||
|
|
||||||
++total_n_launched;
|
++total_n_launched;
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
|
@ -1296,7 +1296,9 @@ test_evbuffer_callbacks(void *ptr)
|
|||||||
evbuffer_drain(buf_out2, evbuffer_get_length(buf_out2));
|
evbuffer_drain(buf_out2, evbuffer_get_length(buf_out2));
|
||||||
/* Let's test the obsolete buffer_setcb function too. */
|
/* Let's test the obsolete buffer_setcb function too. */
|
||||||
cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
|
cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
|
||||||
|
tt_assert(cb1 != NULL);
|
||||||
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
|
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
|
||||||
|
tt_assert(cb2 != NULL);
|
||||||
evbuffer_setcb(buf, self_draining_callback, NULL);
|
evbuffer_setcb(buf, self_draining_callback, NULL);
|
||||||
evbuffer_add_printf(buf, "This should get drained right away.");
|
evbuffer_add_printf(buf, "This should get drained right away.");
|
||||||
tt_uint_op(evbuffer_get_length(buf), ==, 0);
|
tt_uint_op(evbuffer_get_length(buf), ==, 0);
|
||||||
|
@ -1626,10 +1626,9 @@ gaic_launch(struct event_base *base, struct evdns_base *dns_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
||||||
struct event_base *base = data->base;
|
|
||||||
struct evdns_base *dns_base = NULL;
|
struct evdns_base *dns_base = NULL;
|
||||||
struct evdns_server_port *server = NULL;
|
struct evdns_server_port *server = NULL;
|
||||||
evutil_socket_t fd = -1;
|
evutil_socket_t fd = -1;
|
||||||
@ -1701,7 +1700,7 @@ struct testcase_t dns_testcases[] = {
|
|||||||
{ "getaddrinfo_async", test_getaddrinfo_async,
|
{ "getaddrinfo_async", test_getaddrinfo_async,
|
||||||
TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"" },
|
TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"" },
|
||||||
{ "getaddrinfo_cancel_stress", test_getaddrinfo_async_cancel_stress,
|
{ "getaddrinfo_cancel_stress", test_getaddrinfo_async_cancel_stress,
|
||||||
TT_FORK|TT_NEED_BASE, &basic_setup, (char*)"" },
|
TT_FORK, NULL, NULL },
|
||||||
|
|
||||||
END_OF_TESTCASES
|
END_OF_TESTCASES
|
||||||
};
|
};
|
||||||
|
@ -570,6 +570,8 @@ http_bad_request_test(void *arg)
|
|||||||
/* real NULL request */
|
/* real NULL request */
|
||||||
http_request = "";
|
http_request = "";
|
||||||
|
|
||||||
|
bufferevent_write(bev, http_request, strlen(http_request));
|
||||||
|
|
||||||
shutdown(fd, SHUT_WR);
|
shutdown(fd, SHUT_WR);
|
||||||
timerclear(&tv);
|
timerclear(&tv);
|
||||||
tv.tv_usec = 10000;
|
tv.tv_usec = 10000;
|
||||||
|
@ -276,6 +276,7 @@ test_bufferevent_zlib(void *arg)
|
|||||||
tt_int_op(r, ==, Z_OK);
|
tt_int_op(r, ==, Z_OK);
|
||||||
memset(&z_input, 0, sizeof(z_input));
|
memset(&z_input, 0, sizeof(z_input));
|
||||||
r = inflateInit(&z_input);
|
r = inflateInit(&z_input);
|
||||||
|
tt_int_op(r, ==, Z_OK);
|
||||||
|
|
||||||
/* initialize filters */
|
/* initialize filters */
|
||||||
bev1 = bufferevent_filter_new(bev1, NULL, zlib_output_filter,
|
bev1 = bufferevent_filter_new(bev1, NULL, zlib_output_filter,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user