Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2361 → Rev 2362

/kernel/branches/net/network/socket.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Written by hidnplayr@kolibrios.org, ;;
157,8 → 157,8
 
struct STREAM_SOCKET TCP_SOCKET
 
rcv rd sizeof.RING_BUFFER/4
snd rd sizeof.RING_BUFFER/4
rcv RING_BUFFER
snd RING_BUFFER
 
ends
 
1410,8 → 1410,8
jnz .no_tcp
 
mov ebx, eax
stdcall kernel_free, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.start_ptr]
stdcall kernel_free, [ebx + STREAM_SOCKET.snd + RING_BUFFER.start_ptr]
stdcall kernel_free, [ebx + STREAM_SOCKET.rcv.start_ptr]
stdcall kernel_free, [ebx + STREAM_SOCKET.snd.start_ptr]
mov eax, ebx
.no_tcp:
 
/kernel/branches/net/network/tcp.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;;
/kernel/branches/net/network/tcp_input.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;;
434,7 → 434,7
 
; Calculate receive window size
 
; mov eax, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.size]
; mov eax, [ebx + STREAM_SOCKET.rcv.size]
; neg eax
; add eax, SOCKETBUFFSIZE
; mov edx, [ebx + TCP_SOCKET.RCV_ADV]
1306,7 → 1306,7
;;; 1040-1050
 
movzx eax, [edx + TCP_header.UrgentPointer]
add eax, [ebx + STREAM_SOCKET.rcv + RING_BUFFER.size]
add eax, [ebx + STREAM_SOCKET.rcv.size]
cmp eax, SOCKET_MAXDATA
jbe .not_urgent
 
/kernel/branches/net/network/tcp_output.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;;
75,7 → 75,7
test ecx, ecx
jnz .no_zero_window
 
cmp ebx, [eax + STREAM_SOCKET.snd + RING_BUFFER.size]
cmp ebx, [eax + STREAM_SOCKET.snd.size]
jae @f
 
and dl, not (TH_FIN) ; clear the FIN flag ??? how can it be set before?
93,7 → 93,7
;--------------------------------
; Calculate how much data to send (106)
 
mov esi, [eax + STREAM_SOCKET.snd + RING_BUFFER.size]
mov esi, [eax + STREAM_SOCKET.snd.size]
cmp esi, ecx
jb @f
mov esi, ecx
146,7 → 146,7
mov edi, [eax + TCP_SOCKET.SND_NXT]
add edi, esi
sub edi, [eax + TCP_SOCKET.SND_UNA]
sub edi, [eax + STREAM_SOCKET.snd + RING_BUFFER.size]
sub edi, [eax + STREAM_SOCKET.snd.size]
jns @f
 
and dl, not (TH_FIN)
157,7 → 157,7
; calculate window advertisement (130)
 
mov ecx, SOCKET_MAXDATA
sub ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size]
sub ecx, [eax + STREAM_SOCKET.rcv.size]
 
;------------------------------
; Sender silly window avoidance (131)
168,7 → 168,13
cmp esi, [eax + TCP_SOCKET.t_maxseg]
je .send
 
;;; if (idle or TF_NODELAY) && (esi + ebx >= so_snd.sb_cc), send
test [eax + TCP_SOCKET.t_flags], TF_NODELAY
jnz @f
; TODO: if not 'idle', skip to next codeblock
@@:
add ebx, esi
cmp ebx, [eax + STREAM_SOCKET.snd.size]
jae .send
 
test [eax + TCP_SOCKET.t_force], -1 ;;;
jnz .send
190,8 → 196,24
test ecx, ecx
jz .no_window
 
;;; TODO 167-172
push ecx
mov cl, [eax + TCP_SOCKET.RCV_SCALE]
inc cl ; we want it *2
mov ebx, TCP_max_win
shl ebx, cl
pop ecx
cmp ebx, ecx
cmovb ebx, ecx
 
; now ebx is TWICE the amount we can increase the window
; (with TCP_max_win shl rcv_scale as the maximum)
 
cmp ebx, [eax + TCP_SOCKET.t_maxseg]
jae .send
 
;;; cmp ebx, [eax + ] ;;; TODO: check receive buffer high water mark
;;; jae .send
 
.no_window:
 
;--------------------------
224,11 → 246,19
 
.enter_persist:
 
cmp [eax + STREAM_SOCKET.snd.size], 0 ; Data ready to send?
jne @f
cmp [eax + TCP_SOCKET.timer_retransmission], 0
jne @f
cmp [eax + TCP_SOCKET.timer_persist], 0 ; Persist timer already expired?
jne @f
 
DEBUGF 1,"Entering persist state\n"
 
mov [eax + TCP_SOCKET.t_rxtshift], 0
TCP_set_persist eax
@@:
 
;;; 213 - 217
 
;----------------------------
; No reason to send a segment (219)
 
463,10 → 493,12
mov edx, [eax + TCP_SOCKET.t_rxtcur]
mov [eax + TCP_SOCKET.timer_retransmission], dx
 
cmp [eax + TCP_SOCKET.timer_persist], 0
jne @f
mov [eax + TCP_SOCKET.timer_persist], 0
mov [eax + TCP_SOCKET.t_rxtshift], 0 ;;; TODO: only do this if timer_persist was set
mov [eax + TCP_SOCKET.t_rxtshift], 0
@@:
 
 
.retransmit_set:
 
;--------------------
/kernel/branches/net/network/tcp_subr.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the tcp/ip network stack for KolibriOS ;;
379,4 → 379,26
DEBUGF 1,"TCP_respond failed\n"
add esp, 2+4
 
ret
ret
 
 
 
macro TCP_set_persist socket {
 
;int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
;int tt;
;
;tp->t_flags &= ~TF_PREVVALID;
;
;if (tcp_timer_active(tp, TT_REXMT))
; panic("tcp_setpersist: retransmit pending");
;
;; Start/restart persistance timer.
;
;TCPT_RANGESET(tt, t * tcp_backoff[tp->t_rxtshift], TCPTV_PERSMIN, TCPTV_PERSMAX);
;tcp_timer_activate(tp, TT_PERSIST, tt);
;
;if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
; tp->t_rxtshift++;
 
}