aboutsummaryrefslogtreecommitdiff
path: root/src/sman
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-06-30 05:00:15 +0000
committerdos-reis <gdr@axiomatics.org>2013-06-30 05:00:15 +0000
commita55fc6a97340fb8a42eab82f97f1693971e75567 (patch)
treea6722d4cc310b00ffc6a0cca21b52ba916c6a6dc /src/sman
parentacefbb3a16acf5752ee60579b21d67a4f20676f2 (diff)
downloadopen-axiom-a55fc6a97340fb8a42eab82f97f1693971e75567.tar.gz
Simplify 'server' definition and use.
Diffstat (limited to 'src/sman')
-rw-r--r--src/sman/session.c10
-rw-r--r--src/sman/sman.c25
2 files changed, 13 insertions, 22 deletions
diff --git a/src/sman/session.c b/src/sman/session.c
index 431580d8..6c3746d2 100644
--- a/src/sman/session.c
+++ b/src/sman/session.c
@@ -2,7 +2,7 @@
Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2009, Gabriel Dos Reis.
+ Copyright (C) 2007-2013, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -445,9 +445,9 @@ fprintf(stderr,"rd=%u]\n",*((long *)rd.fds_bits));
read_from_spad_io(); }
- if (FD_ISSET(server[1].socket, &rd)) {
+ if (FD_ISSET(server.socket, &rd)) {
/* Someone wants to connect to our server socket */
- accept_session_connection(server+1); }
+ accept_session_connection(&server); }
for(pSock=plSock; pSock != (Sock_List *) 0 ; pSock=pSock->next) {
@@ -521,9 +521,9 @@ main(void)
else {
#ifdef DEBUG
fprintf(stderr, "session: opened SessionServer , fd = %d\n",
- server[1].socket);
+ server.socket);
#endif
- FD_SET(server[1].socket,&session_socket_mask);
+ FD_SET(server.socket,&session_socket_mask);
}
manage_sessions();
return(0);
diff --git a/src/sman/sman.c b/src/sman/sman.c
index 1efe4c5c..c8c357f2 100644
--- a/src/sman/sman.c
+++ b/src/sman/sman.c
@@ -1,7 +1,7 @@
/*
Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2010, Gabriel Dos Reis.
+ Copyright (C) 2007-2013, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -84,7 +84,6 @@ static void clean_hypertex_socket(void);
static void read_from_spad_io(int);
static void read_from_manager(int);
static void manage_spad_io(int);
-static void init_spad_process_list(void);
static SpadProcess* find_child(int);
static void kill_all_children(void);
static void clean_up_terminal(void);
@@ -655,20 +654,18 @@ manage_spad_io(int ptcNum)
if (FD_ISSET(ptcNum, &rd)) {
read_from_spad_io(ptcNum);
}
- for(i=0; i<2; i++) {
- if (server[i].socket > 0 && FD_ISSET(server[i].socket, &rd)) {
- p = accept_connection(server+i);
- switch(p) {
- case SessionIO:
+ if (server.socket > 0 && FD_ISSET(server.socket, &rd)) {
+ p = accept_connection();
+ switch(p) {
+ case SessionIO:
session_io = purpose_table[SessionIO];
/* printf("connected session manager\n\r");*/
printf("\n");
break;
- default:
+ default:
printf("sman: Unknown connection request type: %d\n", p);
break;
- }
- }
+ }
}
if (session_io != NULL && FD_ISSET(session_io->socket, &rd)) {
read_from_manager(ptcNum);
@@ -676,12 +673,6 @@ manage_spad_io(int ptcNum)
}
}
-static void
-init_spad_process_list(void)
-{
- spad_process_list = NULL;
-}
-
#if 0
static void
print_spad_process_list()
@@ -780,7 +771,7 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
bsdSignal(SIGINT, SIG_IGN,RestartSystemCalls);
init_term_io();
- init_spad_process_list();
+ spad_process_list = NULL;
start_the_Axiom(&command);
if (open_server(SessionIOName) == -2) {
fprintf(stderr, "Fatal error opening I/O socket\n");