From a54b9e292164473f4553881acc66f20a4f3fbd61 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 24 Oct 2012 21:34:32 +0200 Subject: [PATCH] benchmark: timed_udp_pummel should not write to closed udp handle This fixes intermittent assertion failures when running the benchmark. --- test/benchmark-udp-pummel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/benchmark-udp-pummel.c b/test/benchmark-udp-pummel.c index 01f9a948..a41dce64 100644 --- a/test/benchmark-udp-pummel.c +++ b/test/benchmark-udp-pummel.c @@ -56,6 +56,7 @@ static unsigned int send_cb_called; static unsigned int recv_cb_called; static unsigned int close_cb_called; static int timed; +static int exiting; static uv_buf_t alloc_cb(uv_handle_t* handle, size_t suggested_size) { @@ -76,6 +77,9 @@ static void send_cb(uv_udp_send_t* req, int status) { return; } + if (exiting) + return; + s = container_of(req, struct sender_state, send_req); ASSERT(req->handle == &s->udp_handle); @@ -129,6 +133,8 @@ static void close_cb(uv_handle_t* handle) { static void timeout_cb(uv_timer_t* timer, int status) { int i; + exiting = 1; + for (i = 0; i < n_senders_; i++) uv_close((uv_handle_t*)&senders[i].udp_handle, close_cb);