From 4bceec50e4d583907d90e6764034c06b102830c8 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Sun, 17 Feb 2013 20:39:37 +0000 Subject: [PATCH] Fixed some bugs with non-blocking local sockets. git-svn-id: svn://kolibrios.org@3253 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/socket.inc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/kernel/branches/net/network/socket.inc b/kernel/branches/net/network/socket.inc index da3abe0033..74bf4b3769 100644 --- a/kernel/branches/net/network/socket.inc +++ b/kernel/branches/net/network/socket.inc @@ -834,6 +834,20 @@ SOCKET_receive_dgram: .block: SOCKET_block eax, .loop, s_error +align 4 +SOCKET_receive_local: + + ; does this socket have a PID yet? + cmp [eax + SOCKET.PID], 0 + jne @f + + ; Change PID to that of current process + mov ebx, [TASK_BASE] + mov ebx, [ebx + TASKDATA.pid] + mov [eax + SOCKET.PID], ebx + @@: + + mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream align 4 SOCKET_receive_stream: @@ -953,8 +967,6 @@ SOCKET_send_pppoe: align 4 SOCKET_send_local: - DEBUGF 1,"SOCKET_send: LOCAL\n" - ; does this socket have a PID yet? cmp [eax + SOCKET.PID], 0 jne @f @@ -964,6 +976,12 @@ SOCKET_send_local: mov ebx, [ebx + TASKDATA.pid] mov [eax + SOCKET.PID], ebx @@: + mov [eax + SOCKET.snd_proc], SOCKET_send_local_ + +align 4 +SOCKET_send_local_: + + DEBUGF 1,"SOCKET_send: LOCAL\n" ; get the other side's socket and check if it still exists mov eax, [eax + SOCKET.device] @@ -1133,7 +1151,7 @@ SOCKET_pair: mov [eax + SOCKET.Type], SOCK_STREAM mov [eax + SOCKET.Protocol], 0 ;;; CHECKME mov [eax + SOCKET.snd_proc], SOCKET_send_local - mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream + mov [eax + SOCKET.rcv_proc], SOCKET_receive_local mov ebx, eax call SOCKET_alloc @@ -1144,7 +1162,7 @@ SOCKET_pair: mov [eax + SOCKET.Type], SOCK_STREAM mov [eax + SOCKET.Protocol], 0 ;;; CHECKME mov [eax + SOCKET.snd_proc], SOCKET_send_local - mov [eax + SOCKET.rcv_proc], SOCKET_receive_stream + mov [eax + SOCKET.rcv_proc], SOCKET_receive_local ; Link the two sockets to eachother mov [eax + SOCKET.device], ebx