diff --git a/kernel/branches/net/network/socket.inc b/kernel/branches/net/network/socket.inc index c46d7f41fb..c8a76d3f98 100644 --- a/kernel/branches/net/network/socket.inc +++ b/kernel/branches/net/network/socket.inc @@ -76,7 +76,7 @@ struct TCP_SOCKET IP_SOCKET SND_WND dd ? ; send window ; receive sequence - RCV_WND dw ? ; receive window ; FIXME: better use a dword? + RCV_WND dd ? ; receive window RCV_NXT dd ? ; next receive sequence number to use RCV_UP dd ? ; urgent pointer IRS dd ? ; initial receive sequence number diff --git a/kernel/branches/net/network/tcp_input.inc b/kernel/branches/net/network/tcp_input.inc index 585e1803c3..e69601fb87 100644 --- a/kernel/branches/net/network/tcp_input.inc +++ b/kernel/branches/net/network/tcp_input.inc @@ -37,7 +37,7 @@ TCP_input: pushfd cli - DEBUGF 1,"TCP_input: size=%u\n", ecx + DEBUGF 1,"TCP_input: size=%u time=%d\n", ecx, [timer_ticks] ; First, record the current time mov eax, [timer_ticks] ; in 1/100 seconds @@ -500,8 +500,8 @@ TCP_input: jg @f mov eax, edx @@: - DEBUGF 1,"Receive window size=%d\n", ax - mov [ebx + TCP_SOCKET.RCV_WND], ax + DEBUGF 1,"Receive window size=%d\n", eax + mov [ebx + TCP_SOCKET.RCV_WND], eax pop edx ; If listen or Syn sent, go to that specific code right away @@ -598,7 +598,7 @@ TCP_input: mov eax, [edx + TCP_header.SequenceNumber] add eax, ecx sub eax, [ebx + TCP_SOCKET.RCV_NXT] - sub ax, [ebx + TCP_SOCKET.RCV_WND] ; eax now holds the number of bytes to drop + sub eax, [ebx + TCP_SOCKET.RCV_WND] ; eax now holds the number of bytes to drop jle .no_excess_data DEBUGF 1,"%d bytes beyond right edge of window\n", eax @@ -636,10 +636,23 @@ TCP_input: .dont_drop_all: ;;; TODO: update stats ;;; TODO: 733 + sub ecx, eax and [ebx + TCP_SOCKET.t_flags], not (TH_PUSH or TH_FIN) .no_excess_data: +;--------------------- FIXME ------------------- + + pusha + movzx esi, [edx + TCP_header.DataOffset] + add esi, edx + lea eax, [ebx + STREAM_SOCKET.rcv] + call SOCKET_ring_write ; Add the data to the socket buffer + add [ebx + TCP_SOCKET.RCV_NXT], ecx ; Update sequence number with number of bytes we have copied + popa + +;--------------------- FIXME -------------------- + ;----------------- ; Record timestamp (737-746) @@ -1325,8 +1338,6 @@ align 4 ; Ignore bogus urgent offsets - ;;; 1040-1050 - movzx eax, [edx + TCP_header.UrgentPointer] add eax, [ebx + STREAM_SOCKET.rcv.size] cmp eax, SOCKET_MAXDATA