Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Tools / NetTest / cmdline_backend.c
index f95895a..5e10672 100644 (file)
@@ -1,6 +1,11 @@
 /*
+ * Acess2 Network Tester
+ * - By John Hodge (thePowersGang)
+ *
+ * cmdline_backend.c
+ * - Backend Thread for 'cmdline' suite
  */
-#define DEBUG  1
+#define DEBUG  0
 #include "cmdline.h"
 #include "tcpserver.h"
 #include <vfs_ext.h>
@@ -30,18 +35,27 @@ void Cmdline_Backend_Thread(void *unused)
                 int    max = -1;
                
                FD_ZERO(&rfd);
+               FD_ZERO(&wfd);
                
                LOG("gpCmdline_TCPEchoServer = %p", gpCmdline_TCPEchoServer);
                if(gpCmdline_TCPEchoServer)
                        max = MAX(max, NetTest_TCPServer_FillSelect(gpCmdline_TCPEchoServer, &rfd));
                
-               memcpy(&wfd, &rfd, sizeof(rfd));
+               //memcpy(&wfd, &rfd, sizeof(rfd));
                memcpy(&efd, &rfd, sizeof(rfd));
                
                LOG("max = %i", max);
-               int rv = VFS_Select(max+1, &rfd, &wfd, &efd, NULL, THREAD_EVENT_USER1, true);
+               int rv = VFS_Select(max+1, &rfd, &wfd, &efd, NULL, THREAD_EVENT_USER1, false);
                LOG("rv = %i", rv);
                
+               if( rv < 0 ) {
+                       // Oh, shite
+               }
+               
+               // Woken with no file changes, skip checking
+               if( rv == 0 )
+                       continue ;
+               
                if(gpCmdline_TCPEchoServer)
                        NetTest_TCPServer_HandleSelect(gpCmdline_TCPEchoServer, &rfd, &wfd, &efd);
        }

UCC git Repository :: git.ucc.asn.au