don't fork when accepting a connection
authorChristian Pulvermacher <christian@hazel.(none)>
Mon, 11 Oct 2010 10:41:12 +0000 (12:41 +0200)
committerChristian Pulvermacher <christian@hazel.(none)>
Mon, 11 Oct 2010 10:41:12 +0000 (12:41 +0200)
libvnc/libvncclient/listen.c

index 7347a27..d5f6704 100644 (file)
@@ -84,24 +84,29 @@ listenForIncomingConnections(rfbClient* client)
       if (!SetNonBlocking(client->sock))
        return;
 
-      /* Now fork off a new process to deal with it... */
-
-      switch (fork()) {
-
-      case -1: 
-       rfbClientErr("fork\n"); 
-       return;
-
-      case 0:
-       /* child - return to caller */
+       //modified to accept only a single connection
+       //if something goes wrong, we can always create another listening socket
        close(listenSocket);
        return;
 
-      default:
-       /* parent - go round and listen again */
-       close(client->sock); 
-       break;
-      }
+//      /* Now fork off a new process to deal with it... */
+//
+//      switch (fork()) {
+//
+//      case -1: 
+//     rfbClientErr("fork\n"); 
+//     return;
+//
+//      case 0:
+//     /* child - return to caller */
+//     close(listenSocket);
+//     return;
+//
+//      default:
+//     /* parent - go round and listen again */
+//     close(client->sock); 
+//     break;
+//      }
     }
   }
 #endif