summaryrefslogtreecommitdiff
path: root/src/tools/cbr
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cbr')
-rw-r--r--src/tools/cbr/cbr.c16
-rw-r--r--src/tools/cbr/cbr_server.c5
2 files changed, 11 insertions, 10 deletions
diff --git a/src/tools/cbr/cbr.c b/src/tools/cbr/cbr.c
index 65783119..e42492df 100644
--- a/src/tools/cbr/cbr.c
+++ b/src/tools/cbr/cbr.c
@@ -72,14 +72,10 @@ int main(int argc, char ** argv)
int ret = 0;
char * rem = NULL;
char * s_apn = NULL;
+ char ** argv_dup = argv;
bool server = false;
- if (ap_init(argv[0]) < 0) {
- printf("Failed to init.\n");
- exit(EXIT_FAILURE);
- }
-
server_settings.interval = 1; /* One second reporting interval */
server_settings.timeout = 1;
@@ -133,8 +129,18 @@ int main(int argc, char ** argv)
}
if (server) {
+ if (ap_init(argv_dup[0]) < 0) {
+ printf("Failed to init.\n");
+ exit(EXIT_FAILURE);
+ }
+
ret = server_main();
} else {
+ if (ap_init(NULL) < 0) {
+ printf("Failed to init.\n");
+ exit(EXIT_FAILURE);
+ }
+
if (s_apn == NULL) {
printf("No server specified.\n");
usage();
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index d0666551..8eff4a4c 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -219,11 +219,6 @@ int server_main()
return -1;
}
- if (api_bind(NULL) < 0) {
- printf("Failed to bind the server api.");
- return -1;
- }
-
for (i = 0; i < THREADS_SIZE; i++)
pthread_create(&threads[i], NULL, worker, NULL);