diff options
| -rw-r--r-- | include/ouroboros/time_utils.h | 11 | ||||
| -rw-r--r-- | src/tools/cbr/cbr.c | 9 | ||||
| -rw-r--r-- | src/tools/cbr/cbr_client.c | 2 | ||||
| -rw-r--r-- | src/tools/cbr/cbr_server.c | 9 | 
4 files changed, 17 insertions, 14 deletions
diff --git a/include/ouroboros/time_utils.h b/include/ouroboros/time_utils.h index d7274c1d..4b3f3463 100644 --- a/include/ouroboros/time_utils.h +++ b/include/ouroboros/time_utils.h @@ -23,14 +23,17 @@  #ifndef OUROBOROS_TIME_UTILS_H  #define OUROBOROS_TIME_UTILS_H -#ifndef MILLION -#define MILLION  1000000L +#ifdef MILLION +#undef MILLION  #endif -#ifndef BILLION -#define BILLION  1000000000L +#ifdef BILLION +#undef BILLION  #endif +#define MILLION  1000000L +#define BILLION  1000000000L +  #include <sys/time.h>  #include <limits.h> /* LONG_MAX */ diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c index 2317cd62..d7077e9c 100644 --- a/src/tools/cbr/cbr.c +++ b/src/tools/cbr/cbr.c @@ -31,10 +31,7 @@  #include <stdbool.h>  #define SERVER_AP_NAME "cbr-server" -#define CLIENT_AP_NAME "echo-client" - -#define MILLION 1000000 -#define BILLION 1000000000 +#define CLIENT_AP_NAME "cbr-client"  #define BUF_SIZE 1500 @@ -92,7 +89,7 @@ int main(int argc, char ** argv)                          duration = strtol(*(++argv), &rem, 10);                          --argc;                  } else if (strcmp(*argv, "-s") == 0 || -                    strcmp(*argv, "--size") == 0) { +                           strcmp(*argv, "--size") == 0) {                          size = strtol(*(++argv), &rem, 10);                          --argc;                  } else if (strcmp(*argv, "-r") == 0 || @@ -106,7 +103,7 @@ int main(int argc, char ** argv)                                  rate *= BILLION;                          --argc;                  } else if (strcmp(*argv, "-l") == 0 || -                    strcmp(*argv, "--listen") == 0) { +                           strcmp(*argv, "--listen") == 0) {                          server = true;                  } else {                          usage(); diff --git a/src/tools/cbr/cbr_client.c b/src/tools/cbr/cbr_client.c index 7b8e8b3f..330cfa43 100644 --- a/src/tools/cbr/cbr_client.c +++ b/src/tools/cbr/cbr_client.c @@ -31,7 +31,7 @@ int client_main(int duration, int size, long rate)          bool stop = false;          char buf[size];          long seqnr = 0; -        long long gap = size * 8 * (BILLION / rate); /* ns */ +        unsigned long gap = size * 8 * (BILLION / rate); /* ns */          struct timespec start;          struct timespec end; diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c index 14791bd4..553f954d 100644 --- a/src/tools/cbr/cbr_server.c +++ b/src/tools/cbr/cbr_server.c @@ -116,12 +116,15 @@ int server_main()  {          int    server_fd = 0;          int    client_fd = 0; -        char * dif = DIF_NAME; + +        char * dif         = DIF_NAME;          char * client_name = NULL; -        int    i         = 0; + +        int i = 0; +          pthread_t * threads = malloc(sizeof(*threads) * 10);          if (threads == NULL) -                exit(1); +                EXIT_FAILURE;          printf("Server started, interval is %ld s, timeout is %ld s.\n",                 server_settings.interval, server_settings.timeout);  | 
