Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1534 → Rev 1533

/kernel/branches/net/network/socket.inc
702,7 → 702,6
mov edi, edx
add eax, STREAM_SOCKET.rcv
call SOCKET_ring_read
call SOCKET_ring_free
 
mov dword[esp+32], ecx ; return number of bytes copied in ebx
 
/kernel/branches/net/network/tcp.inc
341,7 → 341,6
 
sub ecx, esi ; update packet size
jl .drop
DEBUGF 1,"we got %u bytes of data\n", ecx
 
;-----------------------------------------------------------------------------------------
; Check if this packet has a timestamp option (We do it here so we can process it quickly)
435,10 → 434,10
; unscale the window into a 32 bit value (notice that SND_SCALE must be initialised to 0)
 
movzx eax, [edx + TCP_segment.Window]
push ecx
push cx
mov cl, [ebx + TCP_SOCKET.SND_SCALE]
shl eax, cl
pop ecx
pop cx
 
;;;; do something with eax
 
585,8 → 584,6
cmp eax, [ebx + TCP_SOCKET.SND_MAX]
jne .not_uni_xfer
 
DEBUGF 1,"6\n"
 
;---------------------------------------
; check if we are sender in the uni-xfer
 
596,8 → 593,6
test ecx, ecx
jnz .not_sender
 
DEBUGF 1,"7\n"
 
; - The congestion window is greater than or equal to the current send window.
; This test is true only if the window is fully open, that is, the connection is not in the middle of slow start or congestion avoidance.
mov eax, [ebx + TCP_SOCKET.SND_CWND]
604,17 → 599,13
cmp eax, [ebx + TCP_SOCKET.SND_WND]
jl .not_uni_xfer
 
DEBUGF 1,"8\n"
 
; - The acknowledgment field in the segment is less than or equal to the maximum sequence number sent.
mov eax, [edx + TCP_segment.AckNumber]
cmp eax, [ebx + TCP_SOCKET.SND_MAX]
mov ecx, [edx + TCP_segment.AckNumber]
cmp ecx, [ebx + TCP_SOCKET.SND_MAX]
jg .not_uni_xfer
 
DEBUGF 1,"9\n"
 
; - The acknowledgment field in the segment is greater than the largest unacknowledged sequence number.
sub eax, [ebx + TCP_SOCKET.SND_UNA]
sub ecx, [ebx + TCP_SOCKET.SND_UNA]
jle .not_uni_xfer
 
DEBUGF 1,"Header prediction: we are sender\n"
648,8 → 639,6
.not_sender:
; - The amount of data in the segment is greater than 0 (data count is in ecx)
 
DEBUGF 1,"10\n"
 
; - The acknowledgment field equals the largest unacknowledged sequence number. This means no data is acknowledged by this segment.
mov eax, [edx + TCP_segment.AckNumber]
cmp eax, [ebx + TCP_SOCKET.SND_UNA]
1054,7 → 1043,7
 
.rst_close:
 
DEBUGF 1,"Closing with reset\n"
DEBUGF 1,"Closing with reset"
 
;;; Close the socket
jmp .drop
1072,7 → 1061,7
 
test [edx + TCP_segment.Flags], TH_ACK
jz .drop
@@:
 
;----------------
; Process the ACK
 
1080,13 → 1069,13
jg .ack_dup
jl .ack_nodup
 
DEBUGF 1,"TCP state = syn received\n"
DEBUGF 1,"TCP state = syn received"
 
;;;;;
 
.ack_dup:
 
DEBUGF 1,"Duplicate ACK\n"
DEBUGF 1,"Duplicate ACK"
 
;;;;
 
1094,7 → 1083,7
 
;;;; 887
 
DEBUGF 1,"New ACK\n"
DEBUGF 1,"New ACK"
 
;-------------------------------------------------
; If the congestion window was inflated to account
1125,12 → 1114,9
;------------------------------------------
; Remove acknowledged data from send buffer
 
push ecx
mov ecx, [edx + TCP_segment.AckNumber] ;;;
sub ecx, [ebx + TCP_SOCKET.SND_UNA] ;;;
xor ecx, ecx ;;;;;;
lea eax, [ebx + STREAM_SOCKET.snd]
call SOCKET_ring_free ;;;; 943 - 956
pop ecx
 
;---------------------------------------
; Wake up process waiting on send buffer
1265,7 → 1251,7
 
.do_data:
 
DEBUGF 1,"TCP: do data (%u)\n", ecx
DEBUGF 1,"TCP: do data\n"
 
test [edx + TCP_segment.Flags], TH_FIN
jnz .process_fin
1659,24 → 1645,24
;--------------------------
; Should a segment be sent?
 
test [eax + TCP_SOCKET.t_flags], TF_ACKNOW
test [ebx + TCP_SOCKET.t_flags], TF_ACKNOW
jnz .send
 
test dl, TH_SYN + TH_RST
jnz .send
 
mov ebx, [eax + TCP_SOCKET.SND_UP]
cmp ebx, [eax + TCP_SOCKET.SND_UNA]
mov eax, [ebx + TCP_SOCKET.SND_UP]
cmp eax, [ebx + TCP_SOCKET.SND_UNA]
jg .send
 
test dl, TH_FIN
jz .enter_persist
 
test [eax + TCP_SOCKET.t_flags], TF_SENTFIN
test [ebx + TCP_SOCKET.t_flags], TF_SENTFIN
jnz .send
 
mov ebx, [eax + TCP_SOCKET.SND_NXT]
cmp ebx, [eax + TCP_SOCKET.SND_UNA]
mov eax, [ebx + TCP_SOCKET.SND_NXT]
cmp eax, [ebx + TCP_SOCKET.SND_UNA]
je .send
 
;--------------------