summaryrefslogtreecommitdiff
path: root/src/tools/cbr/cbr_server.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-06-13 13:48:17 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-06-13 13:48:17 +0200
commit7834e92b218da69cd934679dec9c2d714d89d15e (patch)
treee2174dd2810a20e90050481e2fd54ce61e414baf /src/tools/cbr/cbr_server.c
parentddfc7091d2698d36c1cfec49eaaad96b278bb37b (diff)
downloadouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.tar.gz
ouroboros-7834e92b218da69cd934679dec9c2d714d89d15e.zip
lib, irmd, tools, ipcpd: updates to dev API.
The registration function has been moved to the irm tool, applications now need to be registered by an administrator. Currently only supports one instance per registered name, and an AP can be registered under only one name. The irmd can now start a registered server application on demand. For the full functionality of the tool, execute "irm register". AP name removed from flow allocation. Flow allocation does not send the source ap name as it is quite useless. The accept() call now only returns the AE name.
Diffstat (limited to 'src/tools/cbr/cbr_server.c')
-rw-r--r--src/tools/cbr/cbr_server.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index eef1acc9..3a1d8d5c 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -30,7 +30,6 @@
#include <ouroboros/dev.h>
#include <ouroboros/time_utils.h>
-#define DIF_NAME "*"
#define THREADS_SIZE 10
pthread_t listen_thread;
@@ -43,19 +42,12 @@ pthread_cond_t fds_signal;
void shutdown_server(int signo, siginfo_t * info, void * c)
{
- char * dif = DIF_NAME;
int i;
switch(signo) {
case SIGINT:
case SIGTERM:
case SIGHUP:
- if (ap_unreg(&dif, 1)) {
- printf("Failed to unregister application.\n");
- ap_fini();
- exit(EXIT_FAILURE);
- }
-
pthread_cancel(listen_thread);
for (i = 0; i < THREADS_SIZE; i++) {
@@ -157,36 +149,20 @@ void * worker(void * o)
void * listener(void * o)
{
- char * dif = DIF_NAME;
- int server_fd;
- char * client_name = NULL;
int client_fd = 0;
int response = 0;
- if (ap_init(SERVER_AP_NAME)) {
- printf("Failed to init AP.\n");
- exit(EXIT_FAILURE);
- }
-
- server_fd = ap_reg(&dif, 1);
- if (server_fd < 0) {
- printf("Failed to register application.\n");
- ap_fini();
- exit(EXIT_FAILURE);
- }
-
printf("Server started, interval is %ld s, timeout is %ld s.\n",
server_settings.interval, server_settings.timeout);
while (true) {
- client_fd = flow_accept(server_fd,
- &client_name, NULL);
+ client_fd = flow_accept(NULL);
if (client_fd < 0) {
printf("Failed to accept flow.\n");
break;
}
- printf("New flow from %s.\n", client_name);
+ printf("New flow.\n");
pthread_mutex_lock(&fds_lock);
@@ -259,7 +235,5 @@ int server_main()
pthread_join(threads[i], NULL);
}
- ap_fini();
-
return 0;
}