TCP_input: window is now stored as dword, data is now also received when header prediction failed.

git-svn-id: svn://kolibrios.org@2957 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-08-30 07:02:10 +00:00
parent 094a711ed8
commit 85a661d4e9
2 changed files with 18 additions and 7 deletions

View File

@ -76,7 +76,7 @@ struct TCP_SOCKET IP_SOCKET
SND_WND dd ? ; send window SND_WND dd ? ; send window
; receive sequence ; 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_NXT dd ? ; next receive sequence number to use
RCV_UP dd ? ; urgent pointer RCV_UP dd ? ; urgent pointer
IRS dd ? ; initial receive sequence number IRS dd ? ; initial receive sequence number

View File

@ -37,7 +37,7 @@ TCP_input:
pushfd pushfd
cli 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 ; First, record the current time
mov eax, [timer_ticks] ; in 1/100 seconds mov eax, [timer_ticks] ; in 1/100 seconds
@ -500,8 +500,8 @@ TCP_input:
jg @f jg @f
mov eax, edx mov eax, edx
@@: @@:
DEBUGF 1,"Receive window size=%d\n", ax DEBUGF 1,"Receive window size=%d\n", eax
mov [ebx + TCP_SOCKET.RCV_WND], ax mov [ebx + TCP_SOCKET.RCV_WND], eax
pop edx pop edx
; If listen or Syn sent, go to that specific code right away ; If listen or Syn sent, go to that specific code right away
@ -598,7 +598,7 @@ TCP_input:
mov eax, [edx + TCP_header.SequenceNumber] mov eax, [edx + TCP_header.SequenceNumber]
add eax, ecx add eax, ecx
sub eax, [ebx + TCP_SOCKET.RCV_NXT] 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 jle .no_excess_data
DEBUGF 1,"%d bytes beyond right edge of window\n", eax DEBUGF 1,"%d bytes beyond right edge of window\n", eax
@ -636,10 +636,23 @@ TCP_input:
.dont_drop_all: .dont_drop_all:
;;; TODO: update stats ;;; TODO: update stats
;;; TODO: 733 ;;; TODO: 733
sub ecx, eax sub ecx, eax
and [ebx + TCP_SOCKET.t_flags], not (TH_PUSH or TH_FIN) and [ebx + TCP_SOCKET.t_flags], not (TH_PUSH or TH_FIN)
.no_excess_data: .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) ; Record timestamp (737-746)
@ -1325,8 +1338,6 @@ align 4
; Ignore bogus urgent offsets ; Ignore bogus urgent offsets
;;; 1040-1050
movzx eax, [edx + TCP_header.UrgentPointer] movzx eax, [edx + TCP_header.UrgentPointer]
add eax, [ebx + STREAM_SOCKET.rcv.size] add eax, [ebx + STREAM_SOCKET.rcv.size]
cmp eax, SOCKET_MAXDATA cmp eax, SOCKET_MAXDATA