mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 05:48:51 -04:00
Fix coverity warnings in benchmark tools.
Again, not harmful, but best to stay warning-free.
This commit is contained in:
parent
867f401f9b
commit
ff7f739685
13
test/bench.c
13
test/bench.c
@ -60,7 +60,7 @@
|
|||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <evutil.h>
|
#include <evutil.h>
|
||||||
|
|
||||||
static int count, writes, fired;
|
static int count, writes, fired, failures;
|
||||||
static evutil_socket_t *pipes;
|
static evutil_socket_t *pipes;
|
||||||
static int num_pipes, num_active, num_writes;
|
static int num_pipes, num_active, num_writes;
|
||||||
static struct event *events;
|
static struct event *events;
|
||||||
@ -71,12 +71,19 @@ read_cb(evutil_socket_t fd, short which, void *arg)
|
|||||||
{
|
{
|
||||||
ev_intptr_t idx = (ev_intptr_t) arg, widx = idx + 1;
|
ev_intptr_t idx = (ev_intptr_t) arg, widx = idx + 1;
|
||||||
u_char ch;
|
u_char ch;
|
||||||
|
ev_ssize_t n;
|
||||||
|
|
||||||
count += recv(fd, (char*)&ch, sizeof(ch), 0);
|
n = recv(fd, (char*)&ch, sizeof(ch), 0);
|
||||||
|
if (n >= 0)
|
||||||
|
count += n;
|
||||||
|
else
|
||||||
|
failures++
|
||||||
if (writes) {
|
if (writes) {
|
||||||
if (widx >= num_pipes)
|
if (widx >= num_pipes)
|
||||||
widx -= num_pipes;
|
widx -= num_pipes;
|
||||||
(void) send(pipes[2 * widx + 1], "e", 1, 0);
|
n = send(pipes[2 * widx + 1], "e", 1, 0);
|
||||||
|
if (n != 1)
|
||||||
|
failures++
|
||||||
writes--;
|
writes--;
|
||||||
fired++;
|
fired++;
|
||||||
}
|
}
|
||||||
|
@ -178,10 +178,12 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
evhttp_bind_socket(http, "0.0.0.0", port);
|
evhttp_bind_socket(http, "0.0.0.0", port);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
if (use_iocp) {
|
if (use_iocp) {
|
||||||
struct timeval tv={99999999,0};
|
struct timeval tv={99999999,0};
|
||||||
event_base_loopexit(base, &tv);
|
event_base_loopexit(base, &tv);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
event_base_dispatch(base);
|
event_base_dispatch(base);
|
||||||
|
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user