diff options
author | Sander Vrijders <[email protected]> | 2016-10-22 11:33:20 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-10-22 11:33:20 +0000 |
commit | 727efbe0c5e61862a870c71a2857b28eece3d369 (patch) | |
tree | 881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/tools/oping | |
parent | 482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff) | |
parent | 3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff) | |
download | ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip |
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/tools/oping')
-rw-r--r-- | src/tools/oping/oping.c | 10 | ||||
-rw-r--r-- | src/tools/oping/oping_client.c | 15 | ||||
-rw-r--r-- | src/tools/oping/oping_server.c | 13 |
3 files changed, 26 insertions, 12 deletions
diff --git a/src/tools/oping/oping.c b/src/tools/oping/oping.c index 0ca40326..b476b33a 100644 --- a/src/tools/oping/oping.c +++ b/src/tools/oping/oping.c @@ -48,10 +48,10 @@ struct c { /* stats */ int sent; int rcvd; - float rtt_min; - float rtt_max; - float rtt_avg; - float rtt_m2; + double rtt_min; + double rtt_max; + double rtt_avg; + double rtt_m2; flow_set_t * flows; @@ -82,7 +82,7 @@ struct oping_msg { #include "oping_client.c" #include "oping_server.c" -static void usage() +static void usage(void) { printf("Usage: oping [OPTION]...\n" "Checks liveness between a client and a server\n" diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 40f75785..9f49a1df 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -39,6 +39,9 @@ void shutdown_client(int signo, siginfo_t * info, void * c) { + (void) info; + (void) c; + switch(signo) { case SIGINT: case SIGTERM: @@ -59,12 +62,14 @@ void * reader(void * o) struct oping_msg * msg = (struct oping_msg *) buf; int fd = 0; int msg_len = 0; - float ms = 0; - float d = 0; + double ms = 0; + double d = 0; fqueue_t * fq = fqueue_create(); if (fq == NULL) return (void *) 1; + (void) o; + /* FIXME: use flow timeout option once we have it */ while (client.rcvd != client.count && flow_event_wait(client.flows, fq, &timeout) != -ETIMEDOUT) { @@ -78,7 +83,7 @@ void * reader(void * o) continue; } - if (ntohl(msg->id) >= client.count) { + if (ntohl(msg->id) >= (ssize_t) client.count) { printf("Invalid id.\n"); continue; } @@ -89,7 +94,7 @@ void * reader(void * o) pthread_mutex_lock(&client.lock); ms = ts_diff_us(&client.times[ntohl(msg->id)], &now) - /1000.0; + / 1000.0; pthread_mutex_unlock(&client.lock); printf("%d bytes from %s: seq=%d time=%.3f ms\n", @@ -159,7 +164,7 @@ void * writer(void * o) return (void *) 0; } -int client_main() +int client_main(void) { struct sigaction sig_act; diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index 8a5a3512..193b76d1 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -31,6 +31,9 @@ void shutdown_server(int signo, siginfo_t * info, void * c) { + (void) info; + (void) c; + switch(signo) { case SIGINT: case SIGTERM: @@ -47,6 +50,8 @@ void * cleaner_thread(void * o) struct timespec now = {0, 0}; int deadline_ms = 10000; + (void) o; + while (true) { clock_gettime(CLOCK_REALTIME, &now); pthread_mutex_lock(&server.lock); @@ -74,6 +79,8 @@ void * server_thread(void *o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int ret = flow_event_wait(server.flows, fq, &timeout); if (ret == -ETIMEDOUT) @@ -100,7 +107,7 @@ void * server_thread(void *o) server.times[fd] = now; pthread_mutex_unlock(&server.lock); - msg->type = htonl((uint32_t) ECHO_REPLY); + msg->type = htonl(ECHO_REPLY); if (flow_write(fd, buf, msg_len) < 0) { printf("Error writing to flow (fd %d).\n", fd); @@ -117,6 +124,8 @@ void * accept_thread(void * o) int fd = 0; struct timespec now = {0, 0}; + (void) o; + printf("Ouroboros ping server started.\n"); while (true) { @@ -147,7 +156,7 @@ void * accept_thread(void * o) return (void *) 0; } -int server_main() +int server_main(void) { struct sigaction sig_act; |