From 7b10724901aa87d8f819e93796c020463a8ba9f1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson <nickm@torproject.org> Date: Fri, 23 Oct 2009 22:07:05 +0000 Subject: [PATCH] Fix my fix for the bufferevent_connect_fail() test. svn:r1460 --- test/regress_bufferevent.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/regress_bufferevent.c b/test/regress_bufferevent.c index e605d72a..6fdff374 100644 --- a/test/regress_bufferevent.c +++ b/test/regress_bufferevent.c @@ -537,6 +537,7 @@ test_bufferevent_connect_fail(void *arg) evutil_socket_t fake_listener = -1; ev_socklen_t slen = sizeof(localhost); struct event close_listener_event; + int close_listener_event_added = 0; struct timeval one_second = { 1, 0 }; test_ok = 0; @@ -564,6 +565,7 @@ test_bufferevent_connect_fail(void *arg) evtimer_assign(&close_listener_event, data->base, close_socket_cb, &fake_listener); event_add(&close_listener_event, &one_second); + close_listener_event_added = 1; event_base_dispatch(data->base); @@ -575,6 +577,9 @@ end: if (bev) bufferevent_free(bev); + + if (close_listener_event_added) + event_del(&close_listener_event); } struct testcase_t bufferevent_testcases[] = { -- 2.40.0