diff options
Diffstat (limited to 'src/tools/oping')
| -rw-r--r-- | src/tools/oping/oping_client.c | 11 | ||||
| -rw-r--r-- | src/tools/oping/oping_server.c | 13 | 
2 files changed, 5 insertions, 19 deletions
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index a91a126c..77a08db7 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -176,7 +176,6 @@ static int client_init(void)          client.rtt_m2 = 0;          pthread_mutex_init(&client.lock, NULL); -        pthread_mutex_lock(&client.lock);          return 0;  } @@ -213,21 +212,13 @@ int client_main(void)                  return -1;          } -        fd = flow_alloc(client.s_apn, NULL); +        fd = flow_alloc(client.s_apn, NULL, NULL);          if (fd < 0) {                  printf("Failed to allocate flow.\n"); -                return -1; -        } - -        if (flow_alloc_res(fd)) { -                printf("Flow allocation refused.\n"); -                flow_dealloc(fd);                  client_fini();                  return -1;          } -        pthread_mutex_unlock(&client.lock); -          clock_gettime(CLOCK_REALTIME, &tic);          pthread_create(&client.reader_pt, NULL, reader, &fd); diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c index e20e236d..44a301ba 100644 --- a/src/tools/oping/oping_server.c +++ b/src/tools/oping/oping_server.c @@ -57,6 +57,7 @@ void * cleaner_thread(void * o)                  for (i = 0; i < OPING_MAX_FLOWS; ++i)                          if (flow_set_has(server.flows, i) &&                              ts_diff_ms(&server.times[i], &now) > deadline_ms) { +                                printf("Flow %d timed out.\n", i);                                  flow_set_del(server.flows, i);                                  flow_dealloc(i);                          } @@ -110,8 +111,8 @@ void * server_thread(void *o)  void * accept_thread(void * o)  { -        int fd = 0; -        struct timespec now = {0, 0}; +        int fd; +        struct timespec now;          qosspec_t qs;          (void) o; @@ -119,7 +120,7 @@ void * accept_thread(void * o)          printf("Ouroboros ping server started.\n");          while (true) { -                fd = flow_accept(&qs); +                fd = flow_accept(&qs, NULL);                  if (fd < 0) {                          printf("Failed to accept flow.\n");                          break; @@ -127,12 +128,6 @@ void * accept_thread(void * o)                  printf("New flow %d.\n", fd); -                if (flow_alloc_resp(fd, 0)) { -                        printf("Failed to give an allocate response.\n"); -                        flow_dealloc(fd); -                        continue; -                } -                  clock_gettime(CLOCK_REALTIME, &now);                  pthread_mutex_lock(&server.lock);  | 
