Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4365 → Rev 4366

/kernel/trunk/network/socket.inc
714,6 → 714,11
 
call TCP_usrclosed
 
test eax, eax
jz @f
call TCP_output ; If connection is not closed yet, send the FIN
@@:
 
ret
 
 
2196,7 → 2201,7
;
; Kernel calls this function when a certain process ends
; This function will check if the process had any open sockets
; And update them accordingly
; And update them accordingly (clean up)
;
; IN: edx = pid
; OUT: /
2242,7 → 2247,7
cmp [eax + SOCKET.Protocol], IP_PROTO_TCP
jne .free
 
call TCP_close
call TCP_disconnect
jmp .closed
 
.free:
2347,22 → 2352,11
and [eax + SOCKET.state], not (SS_ISCONNECTING + SS_ISCONNECTED + SS_ISDISCONNECTING)
or [eax + SOCKET.state], SS_CANTRCVMORE + SS_CANTSENDMORE
 
cmp [eax + SOCKET.Protocol], IP_PROTO_TCP
je .tcp
 
cmp [eax + SOCKET.Protocol], IP_PROTO_UDP
je .udp
 
jmp SOCKET_notify
 
.tcp:
.udp:
mov [eax + UDP_SOCKET.LocalPort], 0 ; UDP and TCP structs store localport at the same offset
mov [eax + UDP_SOCKET.RemotePort], 0
 
jmp SOCKET_notify
 
 
;-----------------------------------------------------------------
;
; SOCKET_cant_recv_more
/kernel/trunk/network/tcp_input.inc
567,12 → 567,13
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: Header prediction failed\n"
 
; Calculate receive window size
 
push edx
mov eax, SOCKETBUFFSIZE
mov eax, SOCKET_MAXDATA
sub eax, [ebx + STREAM_SOCKET.rcv.size]
DEBUGF DEBUG_NETWORK_VERBOSE, "Space in receive buffer=%d\n", eax
mov edx, [ebx + TCP_SOCKET.RCV_ADV]
sub edx, [ebx + TCP_SOCKET.RCV_NXT]
DEBUGF DEBUG_NETWORK_VERBOSE, "Current advertised window=%d\n", edx
cmp eax, edx
jg @f
mov eax, edx
1189,13 → 1190,10
call mutex_unlock
pop ebx
 
push ebx
mov eax, ebx
call TCP_disconnect
pop ebx
call TCP_close
jmp .drop_no_socket
 
jmp .destroy_new_socket
 
.ack_tw:
mov [ebx + TCP_SOCKET.timer_timed_wait], 2 * TCP_time_MSL
or [ebx + TCP_SOCKET.timer_flags], timer_flag_wait
/kernel/trunk/network/tcp_output.inc
32,7 → 32,7
temp_bits db ?
endl
 
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: socket=%x\n", eax
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_output: socket=%x state=%u\n", eax, [eax + TCP_SOCKET.t_state]
 
push eax
lea ecx, [eax + SOCKET.mutex]
/kernel/trunk/network/tcp_subr.inc
171,16 → 171,43
 
 
 
;-------------------------
;
; TCP_disconnect
;
; IN: eax = socket ptr
; OUT: eax = socket ptr / 0
;
;-------------------------
align 4
TCP_disconnect:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_disconnect: %x\n", eax
 
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
jb TCP_close ; Connection not yet synchronised, just get rid of the socket
 
; TODO: implement LINGER
 
call SOCKET_is_disconnecting
call TCP_usrclosed
 
test eax, eax
jz @f
push eax
call TCP_output
pop eax
@@:
 
ret
 
 
;-------------------------
;
; TCP_close
;
; IN: eax = socket ptr
; OUT: eax = socket ptr
; OUT: /
;
;-------------------------
align 4
192,8 → 219,10
;;; TODO: update slow start threshold
 
call SOCKET_is_disconnected
;; call SOCKET_free
call SOCKET_free
 
xor eax, eax
 
ret
 
 
/kernel/trunk/network/tcp_usreq.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; Part of the TCP/IP network stack for KolibriOS ;;
57,7 → 57,6
 
.wait1:
mov [eax + TCP_SOCKET.t_state], TCPS_FIN_WAIT_1
; TODO: set timer?
pop ebx
ret
 
68,7 → 67,6
 
.disc:
call SOCKET_is_disconnected
; TODO: set timer?
.ret:
pop ebx
ret
202,35 → 200,4
stdcall cancel_timer_hs, [eax + TCP_SOCKET.timer_connect]
 
xor eax, eax
ret
 
 
 
 
;-------------------------
;
; TCP_disconnect
;
; IN: eax = socket ptr
; OUT: eax = socket ptr
;
;-------------------------
align 4
TCP_disconnect:
 
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_disconnect: %x\n", eax
 
cmp [eax + TCP_SOCKET.t_state], TCPS_ESTABLISHED
jb TCP_close
 
 
; TODO: implement LINGER ?
 
call SOCKET_is_disconnecting
call TCP_usrclosed
 
push eax
call TCP_output
pop eax
 
ret