diff --git a/src/Home/Net/Protocols/TCP/TCP.HH b/src/Home/Net/Protocols/TCP/TCP.HH index d4ab6a8d..e24c7f36 100755 --- a/src/Home/Net/Protocols/TCP/TCP.HH +++ b/src/Home/Net/Protocols/TCP/TCP.HH @@ -6,7 +6,10 @@ #define TCP_RTO_MIN 0.2 #define TCP_RTO_MAX 10 -#define TCP_WINDOW_SIZE 8192 +#define TCP_WINDOW_SIZE 8192 // Should not be static. For now it's okay + +U16 RECEIVE_WINDOW; // gets host window size. It is not static. +U16 SEND_WINDOW; // gets receive window size from host, then adjust accordingly. #define TCP_MSS 536 // Max Segment Size default @@ -24,7 +27,7 @@ #define TCP_STATE_LAST_ACK 9 #define TCP_STATE_TIME_WAIT 10 -// TCP header flags. Test with Bt(), e.g. Bt(&flags, TCPf_RST) +// TCP header flags. Order of Operation matters. Test with Bt(), e.g. Bt(&flags, TCPf_RST) #define TCPf_FIN 0 #define TCPf_SYN 1 #define TCPf_RST 2 diff --git a/src/Home/Net/Protocols/TCP/TCP.ZC b/src/Home/Net/Protocols/TCP/TCP.ZC index 770256c2..77bc836b 100755 --- a/src/Home/Net/Protocols/TCP/TCP.ZC +++ b/src/Home/Net/Protocols/TCP/TCP.ZC @@ -101,7 +101,7 @@ I64 TCPPacketAllocate(U8 **frame_out, header->ack_num = EndianU32(ack_num); header->data_offset = (sizeof(CTCPHeader) / 4) << 4; // ??? header->flags = flags; - header->window_size = EndianU16(TCP_WINDOW_SIZE / 2);// TODO: What is window size supposed to be ? + header->window_size = EndianU16(TCP_WINDOW_SIZE);// Window Size allocation data. Adjusted based on receive window. header->checksum = 0; header->urgent_pointer = 0; @@ -647,8 +647,8 @@ CTCPSocket TCPSocket(U16 domain=AF_UNSPEC) QueueInit(accept_queue); // init pending connection queue tcp_socket->accept_queue = accept_queue; - tcp_socket->receive_buffer_size = TCP_WINDOW_SIZE; - tcp_socket->receive_buffer = CAlloc(TCP_WINDOW_SIZE); + tcp_socket->receive_buffer_size = RECEIVE_WINDOW; + tcp_socket->receive_buffer = CAlloc(RECEIVE_WINDOW); tcp_socket->max_segment_size = TCP_MSS; @@ -1057,7 +1057,7 @@ I64 TCPSocketConnect(CTCPSocket *tcp_socket, CSocketAddressStorage *address) } tcp_socket->connection_time = tS; - tcp_socket->receive_window = TCP_WINDOW_SIZE; + tcp_socket->receive_window = RECEIVE_WINDOW; tcp_socket->state = TCP_STATE_SYN_SENT; TCPSendFlags(tcp_socket, TCPF_SYN); @@ -1165,7 +1165,7 @@ CTCPSocket *TCPSocketAccept(CTCPSocket *tcp_socket) new_socket->next_recv_seq_num = ++pending->segment_seq_num; new_socket->connection_time = tS; - new_socket->receive_window = TCP_WINDOW_SIZE; + new_socket->receive_window = RECEIVE_WINDOW; new_socket->timeout = tcp_socket->timeout; temp_addr = &tcp_socket->source_address;