Moved TCP slow timer handler to separate thread, to avoid possible deadlocks.

git-svn-id: svn://kolibrios.org@5013 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-07-30 09:44:18 +00:00
parent 90df12563a
commit ce330875f5
3 changed files with 29 additions and 11 deletions

View File

@ -313,10 +313,15 @@ stack_handler:
test [net_10ms], 0x3f ; 640ms test [net_10ms], 0x3f ; 640ms
jnz .exit jnz .exit
TCP_timer_640ms
ARP_decrease_entry_ttls ARP_decrease_entry_ttls
IPv4_decrease_fragment_ttls IPv4_decrease_fragment_ttls
xor edx, edx
mov eax, [TCP_timer1_event]
mov ebx, [eax + EVENT.id]
xor esi, esi
call raise_event
.exit: .exit:
ret ret

View File

@ -141,6 +141,7 @@ align 4
TCP_sequence_num dd ? TCP_sequence_num dd ?
TCP_queue rd (TCP_QUEUE_SIZE*sizeof.TCP_queue_entry + sizeof.queue)/4 TCP_queue rd (TCP_QUEUE_SIZE*sizeof.TCP_queue_entry + sizeof.queue)/4
TCP_input_event dd ? TCP_input_event dd ?
TCP_timer1_event dd ?
endg endg
uglobal uglobal
@ -224,7 +225,15 @@ macro TCP_init {
call new_sys_threads call new_sys_threads
test eax, eax test eax, eax
jns @f jns @f
DEBUGF DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP, error %d\n', eax DEBUGF DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP input, error %d\n', eax
@@:
movi ebx, 1
mov ecx, TCP_timer_640ms
call new_sys_threads
test eax, eax
jns @f
DEBUGF DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for TCP timer, error %d\n', eax
@@: @@:
} }

View File

@ -61,13 +61,18 @@ local .exit
} }
;---------------------- align 4
; 640 ms timer proc TCP_timer_640ms ; TODO: implement timed wait timer!
;----------------------
macro TCP_timer_640ms { ; TODO: implement timed wait timer!
local .loop xor esi, esi
local .exit mov ecx, MANUAL_DESTROY
call create_event
mov [TCP_timer1_event], eax
.wait:
mov eax, [TCP_timer1_event]
mov ebx, [eax + EVENT.id]
call wait_event
; Update TCP sequence number ; Update TCP sequence number
@ -81,7 +86,7 @@ local .exit
mov eax, [eax + SOCKET.NextPtr] mov eax, [eax + SOCKET.NextPtr]
.check_only: .check_only:
or eax, eax or eax, eax
jz .exit jz .wait
cmp [eax + SOCKET.Domain], AF_INET4 cmp [eax + SOCKET.Domain], AF_INET4
jne .loop jne .loop
@ -157,9 +162,8 @@ local .exit
mov [eax + TCP_SOCKET.t_force], 0 mov [eax + TCP_SOCKET.t_force], 0
jmp .loop jmp .loop
.exit:
} endp