forked from KolibriOS/kolibrios
More TCP updates + Socket states
git-svn-id: svn://kolibrios.org@1773 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2861c164de
commit
2ba52e3e4a
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
$Revision$
|
$Revision$
|
||||||
|
|
||||||
|
|
||||||
virtual at 0
|
virtual at 0
|
||||||
|
|
||||||
SOCKET:
|
SOCKET:
|
||||||
@ -1680,3 +1681,46 @@ SOCKET_process_end:
|
|||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; SOCKET_is_disconnecting
|
||||||
|
;
|
||||||
|
; IN: eax = socket ptr
|
||||||
|
; OUT: /
|
||||||
|
;
|
||||||
|
;-----------------------------------------------------------------
|
||||||
|
|
||||||
|
align 4
|
||||||
|
SOCKET_is_disconnecting:
|
||||||
|
|
||||||
|
and [eax + SOCKET.options], not (SS_ISCONNECTING)
|
||||||
|
or [eax + SOCKET.options], SS_ISDISCONNECTING + SS_CANTRCVMORE + SS_CANTSENDMORE
|
||||||
|
|
||||||
|
jmp SOCKET_notify_owner
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; SOCKET_is_disconnected
|
||||||
|
;
|
||||||
|
; IN: eax = socket ptr
|
||||||
|
; OUT: /
|
||||||
|
;
|
||||||
|
;-----------------------------------------------------------------
|
||||||
|
|
||||||
|
align 4
|
||||||
|
SOCKET_is_disconnected:
|
||||||
|
|
||||||
|
and [eax + SOCKET.options], not (SS_ISCONNECTING + SS_ISCONNECTED + SS_ISDISCONNECTING)
|
||||||
|
or [eax + SOCKET.options], SS_CANTRCVMORE + SS_CANTSENDMORE
|
||||||
|
|
||||||
|
jmp SOCKET_notify_owner
|
||||||
|
@ -62,6 +62,23 @@ SOCK_RAW equ 3
|
|||||||
; Socket options
|
; Socket options
|
||||||
SO_ACCEPTCON equ 1
|
SO_ACCEPTCON equ 1
|
||||||
|
|
||||||
|
; Socket States
|
||||||
|
SS_NOFDREF equ 0x001 ; no file table ref any more
|
||||||
|
SS_ISCONNECTED equ 0x002 ; socket connected to a peer
|
||||||
|
SS_ISCONNECTING equ 0x004 ; in process of connecting to peer
|
||||||
|
SS_ISDISCONNECTING equ 0x008 ; in process of disconnecting
|
||||||
|
SS_CANTSENDMORE equ 0x010 ; can't send more data to peer
|
||||||
|
SS_CANTRCVMORE equ 0x020 ; can't receive more data from peer
|
||||||
|
SS_RCVATMARK equ 0x040 ; at mark on input
|
||||||
|
SS_ISABORTING equ 0x080 ; aborting fd references - close()
|
||||||
|
SS_RESTARTSYS equ 0x100 ; restart blocked system calls
|
||||||
|
SS_ISDISCONNECTED equ 0x800 ; socket disconnected from peer
|
||||||
|
|
||||||
|
SS_ASYNC equ 0x100 ; async i/o notify
|
||||||
|
SS_ISCONFIRMING equ 0x200 ; deciding to accept connection req
|
||||||
|
SS_MORETOCOME equ 0x400 ;
|
||||||
|
|
||||||
|
|
||||||
SOCKET_MAXDATA equ 4096*32 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
SOCKET_MAXDATA equ 4096*32 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
||||||
|
|
||||||
; Network driver types
|
; Network driver types
|
||||||
|
@ -1129,10 +1129,11 @@ align 4
|
|||||||
.ack_fw1:
|
.ack_fw1:
|
||||||
jz .ack_processed
|
jz .ack_processed
|
||||||
|
|
||||||
test [ebx + SOCKET.state], SO_CANTRCVMORE
|
test [ebx + SOCKET.state], SS_CANTRCVMORE
|
||||||
jnz @f
|
jnz @f
|
||||||
;;soisdisconnected(ebx)
|
mov eax, ebx
|
||||||
mov [ebx + TCP_SOCKET.timer_timed_wait], TCP_time_max_idle
|
call SOCKET_is_disconnected
|
||||||
|
;;; mov [ebx + TCP_SOCKET.timer_timed_wait], TCP_time_max_idle
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov [ebx + TCP_SOCKET.t_state], TCB_FIN_WAIT_2
|
mov [ebx + TCP_SOCKET.t_state], TCB_FIN_WAIT_2
|
||||||
@ -1143,15 +1144,19 @@ align 4
|
|||||||
jz .ack_processed
|
jz .ack_processed
|
||||||
|
|
||||||
mov [ebx + TCP_SOCKET.t_state], TCB_TIMED_WAIT
|
mov [ebx + TCP_SOCKET.t_state], TCB_TIMED_WAIT
|
||||||
|
mov eax, ebx
|
||||||
call TCP_cancel_timers
|
call TCP_cancel_timers
|
||||||
mov [ebx + TCP_SOCKET.timer_timed_wait], 2 * TCP_time_MSL
|
mov [ebx + TCP_SOCKET.timer_timed_wait], 2 * TCP_time_MSL
|
||||||
;;soisdisconnected(ebx)
|
mov eax, ebx
|
||||||
|
call SOCKET_is_disconnected
|
||||||
jmp .ack_processed
|
jmp .ack_processed
|
||||||
|
|
||||||
|
|
||||||
.ack_la:
|
.ack_la:
|
||||||
jz .ack_processed
|
jz .ack_processed
|
||||||
|
|
||||||
|
|
||||||
|
mov eax, ebx
|
||||||
call TCP_close
|
call TCP_close
|
||||||
jmp .drop
|
jmp .drop
|
||||||
|
|
||||||
|
@ -112,3 +112,24 @@ local .exit
|
|||||||
.exit:
|
.exit:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; eax = socket
|
||||||
|
|
||||||
|
TCP_cancel_timers:
|
||||||
|
|
||||||
|
push eax edi
|
||||||
|
|
||||||
|
lea edi, [eax + TCP_SOCKET.timer_retransmission]
|
||||||
|
xor eax, eax
|
||||||
|
stosd
|
||||||
|
stosd
|
||||||
|
stosd
|
||||||
|
stosd
|
||||||
|
stosd
|
||||||
|
|
||||||
|
pop edi eax
|
||||||
|
|
||||||
|
|
||||||
|
ret
|
Loading…
Reference in New Issue
Block a user