Implemented global socket mutex.

git-svn-id: svn://kolibrios.org@3647 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr
2013-06-12 10:21:41 +00:00
parent 97a976fc9a
commit 3e584a778f
5 changed files with 151 additions and 4 deletions

View File

@@ -150,13 +150,18 @@ TCP_process_input:
; (IP Packet TCP Source Port = remote Port) OR (remote Port = 0)
.findpcb:
pusha
mov ecx, socket_mutex
call mutex_lock
popa
mov ebx, net_sockets
mov si, [edx + TCP_header.DestinationPort]
.socket_loop:
mov ebx, [ebx + SOCKET.NextPtr]
or ebx, ebx
jz .respond_seg_reset
jz .no_socket ;respond_seg_reset
cmp [ebx + SOCKET.Domain], AF_INET4
jne .socket_loop
@@ -180,6 +185,11 @@ TCP_process_input:
test ax, ax
jnz .socket_loop
.found_socket: ; ebx now contains the socketpointer
pusha
mov ecx, socket_mutex
call mutex_unlock
popa
DEBUGF DEBUG_NETWORK_VERBOSE, "TCP_input: socket ptr=%x state=%u flags=%x\n", ebx, [ebx + TCP_SOCKET.t_state], [edx + TCP_header.Flags]:2
;----------------------------
@@ -1619,6 +1629,13 @@ align 4
pop ebx
jmp .destroy_new_socket
.no_socket:
pusha
mov ecx, socket_mutex
call mutex_unlock
popa
.respond_seg_reset:
test [edx + TCP_header.Flags], TH_RST
jnz .drop_no_socket