robustify task and sds initialization
[mTask.git] / int / main.c
index de48671..02852ef 100644 (file)
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <strings.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/time.h>
@@ -79,7 +78,8 @@ void read_message(int fd_in, int fd_out)
        case MSG_GET_TASK:
                debug("Receiving a task\n");
                c = task_register(fd_in);
-               write(fd_out, &c, 1);
+//             write(fd_out, &c, 1);
+//             write(fd_out, 
                break;
        case '\n':
                break;
@@ -89,13 +89,14 @@ void read_message(int fd_in, int fd_out)
        default:
                debug("Unknown message: %X\n", c);
        }
+       (void) fd_out;
 }
 
 void open_filedescriptors()
 {
        struct sockaddr_in sa;
 
-       bzero((char *) &sa, sizeof(sa));
+       memset(&sa, 0, sizeof(sa));
        sa.sin_family = AF_INET;
        sa.sin_addr.s_addr = INADDR_ANY;
        sa.sin_port = htons(port);
@@ -151,6 +152,11 @@ int main(int argc, char *argv[])
                opti++;
        }
 
+       //Initialize systems
+       sds_init();
+       task_init();
+
+       //Open communication
        open_filedescriptors();
        write(fd, "\n", 1);