benchmark: timed_udp_pummel should not write to closed udp handle

This fixes intermittent assertion failures when running the benchmark.
This commit is contained in:
Bert Belder 2012-10-24 21:34:32 +02:00
parent 31f9fbce63
commit a54b9e2921

View File

@ -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);