From 4421782b7fb49e160b1c18f2295e6cd1f0b00c04 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 5 Aug 2009 11:39:28 +0000 Subject: Make Control Endpoint stream transfers more reliable by adding in early aborts for unexpected new SETUP tokens, or unexpected status stage during control stream writes. Fix corruption in Device RNDIS demos TCP stack when too many connections attempted simultaneously, freezing the device when a page was re-fetched before the first connection was closed. Fix incorrect model compatibility information in the Host LowLevel demo overview text files. --- Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c | 27 ++++++++++++++---------- Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'Demos/Device/ClassDriver') diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c index 674643381..c94495dc3 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c @@ -381,19 +381,24 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart, void* TCPHeaderInStart, void case TCP_Connection_Listen: if (TCPHeaderIN->Flags == TCP_FLAG_SYN) { - /* SYN connection when closed starts a connection with a peer */ + /* SYN connection starts a connection with a peer */ + if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, + TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived)) + { + TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK); - TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK); - PacketResponse = true; - - TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort, - TCP_Connection_SYNReceived); - - ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); + ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort); - ConnectionInfo->SequenceNumberIn = (SwapEndian_32(TCPHeaderIN->SequenceNumber) + 1); - ConnectionInfo->SequenceNumberOut = 0; - ConnectionInfo->Buffer.InUse = false; + ConnectionInfo->SequenceNumberIn = (SwapEndian_32(TCPHeaderIN->SequenceNumber) + 1); + ConnectionInfo->SequenceNumberOut = 0; + ConnectionInfo->Buffer.InUse = false; + } + else + { + TCPHeaderOUT->Flags = TCP_FLAG_RST; + } + + PacketResponse = true; } break; diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h index b61de7e18..4e1e0d7a6 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h @@ -49,7 +49,7 @@ #define MAX_OPEN_TCP_PORTS 1 /** Maximum number of TCP connections which can be sustained at the one time */ - #define MAX_TCP_CONNECTIONS 1 + #define MAX_TCP_CONNECTIONS 3 /** TCP window size, giving the maximum number of bytes which can be buffered at the one time */ #define TCP_WINDOW_SIZE 512 -- cgit v1.2.3