2 * Acess2 Network Tester
3 * - By John Hodge (thePowersGang)
6 * - Backend Thread for 'cmdline' suite
10 #include "tcpserver.h"
16 void Cmdline_Backend_Thread(void *unused);
19 tThread *gpCmdline_WorkerThread;
20 tNetTest_TCPServer *gpCmdline_TCPEchoServer;
23 void Cmdline_Backend_StartThread(void)
25 ASSERT(!gpCmdline_WorkerThread);
26 gpCmdline_WorkerThread = Proc_SpawnWorker(Cmdline_Backend_Thread, NULL);
29 void Cmdline_Backend_Thread(void *unused)
31 Threads_SetName("Cmdline Worker");
40 LOG("gpCmdline_TCPEchoServer = %p", gpCmdline_TCPEchoServer);
41 if(gpCmdline_TCPEchoServer)
42 max = MAX(max, NetTest_TCPServer_FillSelect(gpCmdline_TCPEchoServer, &rfd));
44 //memcpy(&wfd, &rfd, sizeof(rfd));
45 memcpy(&efd, &rfd, sizeof(rfd));
48 int rv = VFS_Select(max+1, &rfd, &wfd, &efd, NULL, THREAD_EVENT_USER1, false);
55 // Woken with no file changes, skip checking
59 if(gpCmdline_TCPEchoServer)
60 NetTest_TCPServer_HandleSelect(gpCmdline_TCPEchoServer, &rfd, &wfd, &efd);
64 void Cmdline_Backend_StartEchoServer(int Port)
66 if(gpCmdline_TCPEchoServer)
72 gpCmdline_TCPEchoServer = NetTest_TCPServer_Create(Port);
73 Log_Debug("Cmdline", "Echo Server = %p", gpCmdline_TCPEchoServer);
74 Threads_PostEvent(gpCmdline_WorkerThread, THREAD_EVENT_USER1);