Hash :
b1b69ac7
Author :
Date :
2014-01-17T23:20:42
Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP).
- Added new EV_CLOSED event - detects premature connection close
by clients without the necessity of reading all the pending
data. Does not depend on EV_READ and/or EV_WRITE.
- Added new EV_FEATURE_EARLY_CLOSED feature for epoll.
Must be supported for listening to EV_CLOSED event.
- Added new regression test: test-closed.c
- All regression tests passed (test/regress and test/test.sh)
- strace output of test-closed using EV_CLOSED:
socketpair(PF_LOCAL, SOCK_STREAM, 0, [6, 7]) = 0
sendto(6, "test string\0", 12, 0, NULL, 0) = 12
shutdown(6, SHUT_WR) = 0
epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0
epoll_wait(3, {{EPOLLRDHUP, {u32=7, u64=7}}}, 32, 3000) = 1
epoll_ctl(3, EPOLL_CTL_MOD, 7, {EPOLLRDHUP, {u32=7, u64=7}}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...})
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYM...
write(1, "closed_cb: detected connection close "..., 45) = 45
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
# test/Makefile.am for libevent
# Copyright 2000-2007 Niels Provos
# Copyright 2007-2012 Niels Provos and Nick Mathewson
#
# See LICENSE for copying information.
regress_CPPFLAGS = -DTINYTEST_LOCAL
EXTRA_DIST+= \
test/check-dumpevents.py \
test/regress.gen.c \
test/regress.gen.h \
test/regress.rpc \
test/rpcgen_wrapper.sh \
test/test.sh
TESTPROGRAMS = \
test/bench \
test/bench_cascade \
test/bench_http \
test/bench_httpclient \
test/test-changelist \
test/test-dumpevents \
test/test-eof \
test/test-closed \
test/test-fdleak \
test/test-init \
test/test-ratelim \
test/test-time \
test/test-weof \
test/regress
if BUILD_REGRESS
noinst_PROGRAMS += $(TESTPROGRAMS)
EXTRA_PROGRAMS+= test/regress
endif
noinst_HEADERS+= \
test/regress.h \
test/regress_thread.h \
test/tinytest.h \
test/tinytest_local.h \
test/tinytest_macros.h
# We need to copy this file, since automake doesn't want us to use top_srcdir
# in TESTS.
TESTS = test/test-script.sh
test/test-script.sh: test/test.sh
cp $(top_srcdir)/test/test.sh $@
DISTCLEANFILES += test/test-script.sh
if BUILD_REGRESS
BUILT_SOURCES += test/regress.gen.c test/regress.gen.h
endif
test_test_init_SOURCES = test/test-init.c
test_test_init_LDADD = libevent_core.la
test_test_dumpevents_SOURCES = test/test-dumpevents.c
test_test_dumpevents_LDADD = libevent_core.la
test_test_eof_SOURCES = test/test-eof.c
test_test_eof_LDADD = libevent_core.la
test_test_closed_SOURCES = test/test-closed.c
test_test_closed_LDADD = libevent_core.la
test_test_changelist_SOURCES = test/test-changelist.c
test_test_changelist_LDADD = libevent_core.la
test_test_weof_SOURCES = test/test-weof.c
test_test_weof_LDADD = libevent_core.la
test_test_time_SOURCES = test/test-time.c
test_test_time_LDADD = libevent_core.la
test_test_ratelim_SOURCES = test/test-ratelim.c
test_test_ratelim_LDADD = libevent_core.la -lm
test_test_fdleak_SOURCES = test/test-fdleak.c
test_test_fdleak_LDADD = libevent_core.la
test_regress_SOURCES = \
test/regress.c \
test/regress.gen.c \
test/regress.gen.h \
test/regress_buffer.c \
test/regress_bufferevent.c \
test/regress_dns.c \
test/regress_et.c \
test/regress_finalize.c \
test/regress_http.c \
test/regress_listener.c \
test/regress_main.c \
test/regress_minheap.c \
test/regress_rpc.c \
test/regress_testutils.c \
test/regress_testutils.h \
test/regress_util.c \
test/tinytest.c \
$(regress_thread_SOURCES) \
$(regress_zlib_SOURCES)
if PTHREADS
regress_thread_SOURCES = test/regress_thread.c
PTHREAD_LIBS += libevent_pthreads.la
endif
if BUILD_WIN32
regress_thread_SOURCES = test/regress_thread.c
endif
if ZLIB_REGRESS
regress_zlib_SOURCES = test/regress_zlib.c
endif
if BUILD_WIN32
test_regress_SOURCES += test/regress_iocp.c
endif
test_regress_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
test_regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS) -Itest
test_regress_LDFLAGS = $(PTHREAD_CFLAGS)
if OPENSSL
test_regress_SOURCES += test/regress_ssl.c
test_regress_CPPFLAGS += $(OPENSSL_INCS)
test_regress_LDADD += libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD}
endif
test_bench_SOURCES = test/bench.c
test_bench_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_cascade_SOURCES = test/bench_cascade.c
test_bench_cascade_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_http_SOURCES = test/bench_http.c
test_bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
test_bench_httpclient_SOURCES = test/bench_httpclient.c
test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la
test/regress.gen.c test/regress.gen.h: test/rpcgen-attempted
test/rpcgen-attempted: test/regress.rpc event_rpcgen.py test/rpcgen_wrapper.sh
$(AM_V_GEN)date -u > $@
$(AM_V_at)if $(srcdir)/test/rpcgen_wrapper.sh $(srcdir)/test; then \
true; \
else \
echo "No Python installed; stubbing out RPC test." >&2; \
echo " "> test/regress.gen.c; \
echo "#define NO_PYTHON_EXISTS" > test/regress.gen.h; \
fi
CLEANFILES += test/rpcgen-attempted
$(TESTPROGRAMS) : libevent.la