git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/vfs - Return matched flags from VFS_SelectNode
[tpg/acess2.git]
/
Tools
/
NetTest
/
tcpserver.c
diff --git
a/Tools/NetTest/tcpserver.c
b/Tools/NetTest/tcpserver.c
index
d38b442
..
5e4aa72
100644
(file)
--- a/
Tools/NetTest/tcpserver.c
+++ b/
Tools/NetTest/tcpserver.c
@@
-5,6
+5,7
@@
* tcpserver.c
* - TCP Client tester
*/
* tcpserver.c
* - TCP Client tester
*/
+#define DEBUG 1
#include <vfs.h>
#include <vfs_ext.h>
#include <nettest.h>
#include <vfs.h>
#include <vfs_ext.h>
#include <nettest.h>
@@
-45,10
+46,9
@@
void NetTest_TCPServer_Close(tNetTest_TCPServer *Srv)
int NetTest_TCPServer_FillSelect(tNetTest_TCPServer *Srv, fd_set *fds)
{
int NetTest_TCPServer_FillSelect(tNetTest_TCPServer *Srv, fd_set *fds)
{
- ASSERT(Srv->ServerFD >= 0);
int max = -1;
int max = -1;
- if( Srv->nClients
==
MAX_CLIENTS ) {
+ if( Srv->nClients
<
MAX_CLIENTS ) {
max = Srv->ServerFD;
FD_SET(Srv->ServerFD, fds);
}
max = Srv->ServerFD;
FD_SET(Srv->ServerFD, fds);
}
@@
-63,12
+63,21
@@
int NetTest_TCPServer_FillSelect(tNetTest_TCPServer *Srv, fd_set *fds)
void NetTest_TCPServer_HandleSelect(tNetTest_TCPServer *Srv, const fd_set *rfds, const fd_set *wfds, const fd_set *efds)
{
void NetTest_TCPServer_HandleSelect(tNetTest_TCPServer *Srv, const fd_set *rfds, const fd_set *wfds, const fd_set *efds)
{
+ LOG("Srv=%p", Srv);
if( FD_ISSET(Srv->ServerFD, rfds) )
{
// New connection!
ASSERT(Srv->nClients != MAX_CLIENTS);
struct sClient *client = &Srv->Clients[Srv->nClients++];
if( FD_ISSET(Srv->ServerFD, rfds) )
{
// New connection!
ASSERT(Srv->nClients != MAX_CLIENTS);
struct sClient *client = &Srv->Clients[Srv->nClients++];
+ LOG("Child?");
client->FD = VFS_OpenChild(Srv->ServerFD, "", VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE);
client->FD = VFS_OpenChild(Srv->ServerFD, "", VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE);
+ LOG("client->FD = %i", client->FD);
+ }
+ if( FD_ISSET(Srv->ServerFD, efds) )
+ {
+ LOG("Oops, error on server");
+ VFS_Close(Srv->ServerFD);
+ Srv->ServerFD = -1;
}
for( int i = 0; i < Srv->nClients; i ++ )
}
for( int i = 0; i < Srv->nClients; i ++ )
@@
-77,6
+86,11
@@
void NetTest_TCPServer_HandleSelect(tNetTest_TCPServer *Srv, const fd_set *rfds,
if( FD_ISSET(client->FD, rfds) )
{
// RX'd data on client
if( FD_ISSET(client->FD, rfds) )
{
// RX'd data on client
+ // TODO: Cache until '.' is seen, and send all data before+incl that character
+ char buf[1024];
+ size_t len = VFS_Read(client->FD, sizeof(buf), buf);
+ Debug_HexDump("TCP Srv Rx", buf, len);
+ VFS_Write(client->FD, len, buf);
}
if( FD_ISSET(client->FD, efds) )
}
if( FD_ISSET(client->FD, efds) )
UCC
git Repository :: git.ucc.asn.au