summaryrefslogtreecommitdiff
path: root/src/tools/cbr
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-08-21 21:12:03 +0200
committerSander Vrijders <[email protected]>2016-08-21 21:12:03 +0200
commitf0d4305c067044e74c44032c32ce6c4db3c6fffa (patch)
treed895b25fb5a8f7af106c6c2d3228b62ade81b3b4 /src/tools/cbr
parentba27593e3e8406e109393ae383f17c7416675c1e (diff)
parentcee5ae97ee14438b2dabc06bfad9b02e42e4d816 (diff)
downloadouroboros-f0d4305c067044e74c44032c32ce6c4db3c6fffa.tar.gz
ouroboros-f0d4305c067044e74c44032c32ce6c4db3c6fffa.zip
Merged in dstaesse/ouroboros/be-irmd-refactor (pull request #213)
irmd, lib: Rebuild the IRMd data model
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);