Browse Source

Close everything if xs_socket_accept() returns NULL.

default 2 years ago
parent
commit
295507fd9e
1 changed files with 6 additions and 3 deletions
  1. 6 3
      httpd.c

+ 6 - 3
httpd.c

@@ -478,9 +478,12 @@ void httpd(void)
         for (;;) {
             FILE *f = xs_socket_accept(rs);
 
-            xs *job = xs_data_new(&f, sizeof(FILE *));
-
-            job_post(job);
+            if (f != NULL) {
+                xs *job = xs_data_new(&f, sizeof(FILE *));
+                job_post(job);
+            }
+            else
+                break;
         }
     }