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:
parent
31f9fbce63
commit
a54b9e2921
@ -56,6 +56,7 @@ static unsigned int send_cb_called;
|
|||||||
static unsigned int recv_cb_called;
|
static unsigned int recv_cb_called;
|
||||||
static unsigned int close_cb_called;
|
static unsigned int close_cb_called;
|
||||||
static int timed;
|
static int timed;
|
||||||
|
static int exiting;
|
||||||
|
|
||||||
|
|
||||||
static uv_buf_t alloc_cb(uv_handle_t* handle, size_t suggested_size) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exiting)
|
||||||
|
return;
|
||||||
|
|
||||||
s = container_of(req, struct sender_state, send_req);
|
s = container_of(req, struct sender_state, send_req);
|
||||||
ASSERT(req->handle == &s->udp_handle);
|
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) {
|
static void timeout_cb(uv_timer_t* timer, int status) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
exiting = 1;
|
||||||
|
|
||||||
for (i = 0; i < n_senders_; i++)
|
for (i = 0; i < n_senders_; i++)
|
||||||
uv_close((uv_handle_t*)&senders[i].udp_handle, close_cb);
|
uv_close((uv_handle_t*)&senders[i].udp_handle, close_cb);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user