Browse code

Implement unix domain socket command 'quit'.

Dario Rodriguez authored on 02/01/2024 21:06:23
Showing 1 changed files
... ...
@@ -3353,6 +3353,13 @@ fprintf(stderr,"Changing selected id because of command from client \"%s\" (%i).
3353 3353
                 re_socketout(re, nclient, "\n");
3354 3354
         } else if(line[0]=='\0' ) {
3355 3355
                 ; /* ignore the end-of-message (should only receive them on forwarding clients) */
3356
+        } else if(strcmp(line,"quit")==0) {
3357
+                /* close socket */
3358
+#if 0
3359
+fprintf(stderr,"Closing socket because of command from client \"%s\" (%i).\n",line,nclient);
3360
+#endif
3361
+                close(re->comms.clients[nclient]->fd),re->comms.clients[nclient]->fd=-1;
3362
+                return(0);
3356 3363
         } else {
3357 3364
 #if 1
3358 3365
 fprintf(stderr,"Ignoring unknown command from client \"%s\" (%i).\n",line,nclient);