forked from KolibriOS/kolibrios
Fixed timestamp option in TCP_output
git-svn-id: svn://kolibrios.org@2951 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
12409b31b0
commit
dd4fcc8d94
@ -44,7 +44,7 @@ TCP_output:
|
|||||||
|
|
||||||
mov ebx, [eax + TCP_SOCKET.SND_MAX]
|
mov ebx, [eax + TCP_SOCKET.SND_MAX]
|
||||||
cmp ebx, [eax + TCP_SOCKET.SND_UNA]
|
cmp ebx, [eax + TCP_SOCKET.SND_UNA]
|
||||||
jne .not_idle
|
jbe .not_idle
|
||||||
|
|
||||||
mov ebx, [eax + TCP_SOCKET.t_idle]
|
mov ebx, [eax + TCP_SOCKET.t_idle]
|
||||||
cmp ebx, [eax + TCP_SOCKET.t_rxtcur]
|
cmp ebx, [eax + TCP_SOCKET.t_rxtcur]
|
||||||
@ -78,8 +78,8 @@ TCP_output:
|
|||||||
; Otherwise, if window is small but nonzero, and timer expired,
|
; Otherwise, if window is small but nonzero, and timer expired,
|
||||||
; we will send what we can and go to transmit state
|
; we will send what we can and go to transmit state
|
||||||
|
|
||||||
test [eax + TCP_SOCKET.t_force], -1
|
cmp [eax + TCP_SOCKET.t_force], 0
|
||||||
jz .no_force
|
je .no_force
|
||||||
|
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jnz .no_zero_window
|
jnz .no_zero_window
|
||||||
@ -203,32 +203,43 @@ TCP_output:
|
|||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
; Check if a window update should be sent (154)
|
; Check if a window update should be sent (154)
|
||||||
|
|
||||||
|
DEBUGF 1,"TCP_output: window=%d\n", ecx
|
||||||
|
|
||||||
|
; Compare available window to amount of window known to peer (as advertised window less next expected input)
|
||||||
|
; If the difference is at least two max size segments, or at least 50% of the maximum possible window,
|
||||||
|
; Then we want to send a window update to the peer.
|
||||||
|
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
jz .no_window
|
jz .no_window
|
||||||
|
|
||||||
push ecx
|
push ecx
|
||||||
mov cl, [eax + TCP_SOCKET.RCV_SCALE]
|
mov cl, [eax + TCP_SOCKET.RCV_SCALE]
|
||||||
inc cl ; we want it *2
|
|
||||||
mov ebx, TCP_max_win
|
mov ebx, TCP_max_win
|
||||||
shl ebx, cl
|
shl ebx, cl
|
||||||
pop ecx
|
pop ecx
|
||||||
cmp ebx, ecx
|
cmp ebx, ecx
|
||||||
cmovb ebx, ecx
|
jb @f
|
||||||
|
mov ebx, ecx
|
||||||
|
@@:
|
||||||
|
sub ebx, [eax + TCP_SOCKET.RCV_ADV]
|
||||||
|
add ebx, [eax + TCP_SOCKET.RCV_NXT]
|
||||||
|
|
||||||
; now ebx is TWICE the amount we can increase the window
|
mov edi, [eax + TCP_SOCKET.t_maxseg]
|
||||||
; (with TCP_max_win shl rcv_scale as the maximum)
|
shl edi, 1
|
||||||
|
|
||||||
cmp ebx, [eax + TCP_SOCKET.t_maxseg]
|
; cmp ebx, edi
|
||||||
jae TCP_send
|
; jae TCP_send
|
||||||
|
|
||||||
cmp ebx, 8192 ;[eax + TCP_SOCKET.] ;;; FIXME: check with receive buffer high water mark
|
; cmp ebx, [eax + TCP_SOCKET.] ;;; TODO: check with receive buffer high water mark
|
||||||
jae TCP_send
|
; jae TCP_send
|
||||||
|
|
||||||
.no_window:
|
.no_window:
|
||||||
|
|
||||||
;--------------------------
|
;--------------------------
|
||||||
; Should a segment be sent? (174)
|
; Should a segment be sent? (174)
|
||||||
|
|
||||||
|
DEBUGF 1,"TCP_output: 174\n"
|
||||||
|
|
||||||
test [eax + TCP_SOCKET.t_flags], TF_ACKNOW ; we need to ACK
|
test [eax + TCP_SOCKET.t_flags], TF_ACKNOW ; we need to ACK
|
||||||
jnz TCP_send
|
jnz TCP_send
|
||||||
|
|
||||||
@ -320,12 +331,14 @@ TCP_send:
|
|||||||
test [eax + TCP_SOCKET.t_flags], TF_NOOPT
|
test [eax + TCP_SOCKET.t_flags], TF_NOOPT
|
||||||
jnz .options_done
|
jnz .options_done
|
||||||
|
|
||||||
mov ecx, 1460 ;;;; FIXME
|
mov ecx, 1460 ;;;; FIXME: use routing blablabla to determine MSS
|
||||||
or ecx, TCP_OPT_MAXSEG shl 24 + 4 shl 16
|
or ecx, TCP_OPT_MAXSEG shl 24 + 4 shl 16
|
||||||
bswap ecx
|
bswap ecx
|
||||||
push ecx
|
push ecx
|
||||||
add di, 4
|
add di, 4
|
||||||
|
|
||||||
|
DEBUGF 1,"TCP_send: added maxseg option\n"
|
||||||
|
|
||||||
test [eax + TCP_SOCKET.t_flags], TF_REQ_SCALE
|
test [eax + TCP_SOCKET.t_flags], TF_REQ_SCALE
|
||||||
jz .no_syn
|
jz .no_syn
|
||||||
|
|
||||||
@ -342,6 +355,8 @@ TCP_send:
|
|||||||
pushd ecx
|
pushd ecx
|
||||||
add di, 4
|
add di, 4
|
||||||
|
|
||||||
|
DEBUGF 1,"TCP_send: added scale option\n"
|
||||||
|
|
||||||
.no_syn:
|
.no_syn:
|
||||||
|
|
||||||
;------------------------------------
|
;------------------------------------
|
||||||
@ -360,12 +375,12 @@ TCP_send:
|
|||||||
jz .no_timestamp
|
jz .no_timestamp
|
||||||
|
|
||||||
.timestamp:
|
.timestamp:
|
||||||
mov ebx, [timer_ticks]
|
pushd 0
|
||||||
bswap ebx
|
pushd [timer_ticks]
|
||||||
push ebx
|
pushd TCP_OPT_NOP + TCP_OPT_NOP shl 8 + TCP_OPT_TIMESTAMP shl 16 + 10 shl 24
|
||||||
pushw 0
|
add di, 12
|
||||||
pushd TCP_OPT_TIMESTAMP + 10 shl 8 + TCP_OPT_NOP shl 16 + TCP_OPT_NOP shl 24
|
|
||||||
add di, 10
|
DEBUGF 1,"TCP_send: added timestamp\n"
|
||||||
|
|
||||||
.no_timestamp:
|
.no_timestamp:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user