summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/cbr/cbr_server.c9
-rw-r--r--src/tools/echo/echo_server.c5
-rw-r--r--src/tools/oping/oping_server.c5
3 files changed, 17 insertions, 2 deletions
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index fc23363f..d0666551 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -206,7 +206,7 @@ int server_main()
sigaction(SIGHUP, &sig_act, NULL) ||
sigaction(SIGPIPE, &sig_act, NULL)) {
printf("Failed to install sighandler.\n");
- exit(EXIT_FAILURE);
+ return -1;
}
if (pthread_mutex_init(&fds_lock, NULL)) {
@@ -216,7 +216,12 @@ int server_main()
if (pthread_cond_init(&fds_signal, NULL)) {
printf("Failed to init cond.\n");
- exit(EXIT_FAILURE);
+ return -1;
+ }
+
+ if (api_bind(NULL) < 0) {
+ printf("Failed to bind the server api.");
+ return -1;
}
for (i = 0; i < THREADS_SIZE; i++)
diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c
index e6ab9cfd..3106ee35 100644
--- a/src/tools/echo/echo_server.c
+++ b/src/tools/echo/echo_server.c
@@ -39,6 +39,11 @@ int server_main()
char buf[BUF_SIZE];
ssize_t count = 0;
+ if (api_bind(NULL) < 0) {
+ printf("Failed to bind the server api.");
+ return -1;
+ }
+
printf("Starting the server.\n");
/* Manual cleanup is required for now */
diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c
index a5021cba..9e2fa12f 100644
--- a/src/tools/oping/oping_server.c
+++ b/src/tools/oping/oping_server.c
@@ -148,6 +148,11 @@ int server_main()
return -1;
}
+ if (api_bind(NULL) < 0) {
+ printf("Failed to bind the server instance.");
+ return -1;
+ }
+
pthread_create(&server.cleaner_pt, NULL, cleaner_thread, NULL);
pthread_create(&server.accept_pt, NULL, accept_thread, NULL);
pthread_create(&server.server_pt, NULL, server_thread, NULL);