From 51416668c43f8b0cf9c1c34d654179c29c3815bd Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@mail.ru> Date: Fri, 29 Jul 2022 09:18:55 +0200 Subject: [PATCH] Fixed bug - recreateion of sockets when reopened --- src/ac/shell.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ac/shell.c b/src/ac/shell.c index 5d1a352f..14fd2147 100644 --- a/src/ac/shell.c +++ b/src/ac/shell.c @@ -370,6 +370,7 @@ void shell_loop (FILE *file) { struct shelldata sd; int c; + c=0; /* setvbuf(file,NULL,_IONBF,0); fflush(file); */ @@ -404,7 +405,6 @@ void * run_shell (void * arg) const char * addr = "127.0.0.1:5000"; int sockfd, clientsock; int yes; -while(1){ rc = sock_strtoaddr (addr, (struct sockaddr*) &server); @@ -435,16 +435,17 @@ while(1){ client_size = sizeof (client); +while(1){ + clientsock = accept (sockfd, (struct sockaddr*) &client, &client_size); if (clientsock > 0) { sock_addr2str_p (&client, sockstr); cw_dbg (DBG_INFO, "Acceptiong session from %s", sockstr); - printf("New shell lopp\n"); + cw_dbg (DBG_INFO, "Start shell"); shell_loop (fdopen (clientsock, "a+")); - printf("end shell lopp\n"); + cw_dbg (DBG_INFO, "Stop shell"); close (clientsock); - printf("close clsock\n"); }