diff --git a/.nfs000000000a01060e0000009c b/.nfs000000000a01060e0000009c new file mode 100755 index 0000000..1235698 Binary files /dev/null and b/.nfs000000000a01060e0000009c differ diff --git a/client_src/main.c b/client_src/main.c index 426c494..f257f72 100644 --- a/client_src/main.c +++ b/client_src/main.c @@ -24,6 +24,7 @@ void ft_char2signal(int pid, char c) kill(pid, SIGUSR2); else kill(pid, SIGUSR1); + usleep(5); i--; } } diff --git a/client_src/main.o b/client_src/main.o index f6c3d6b..1585502 100644 Binary files a/client_src/main.o and b/client_src/main.o differ diff --git a/server_src/main.c b/server_src/main.c index 72e57b3..e970a61 100644 --- a/server_src/main.c +++ b/server_src/main.c @@ -14,6 +14,7 @@ #include #include #include "../libftx/libftx.h" +#define ALLLOC_SIZE 2000000 char *ft_tab_int_to_str(int *tab, size_t len) { @@ -51,26 +52,20 @@ int ft_is_finished(int *tab, size_t len) void handler(int num) { - static int *tab = NULL; + static int tab[ALLLOC_SIZE]; static size_t len = 0; char *str; - tab = ft_realloc(tab, len, len + 2, sizeof(int)); - if (tab == NULL) - return ; if (len == 0) tab[0] = num; else tab[len] = num == tab[0]; - ft_printf("tab[%d] = %d\n", len, tab[len]); len++; if (ft_is_finished(tab + 1, len - 1)) { str = ft_tab_int_to_str(tab + 1, len - 1); - free(tab); - ft_printf("%s\n", str); + ft_printf("%s", str); free(str); - tab = NULL; len = 0; } } diff --git a/server_src/main.o b/server_src/main.o index 160e770..b339bcf 100644 Binary files a/server_src/main.o and b/server_src/main.o differ