From ba61873d0c4c55c09d3264616331936588a651b3 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Thu, 28 Feb 2013 03:21:03 +0000 Subject: [PATCH] Fixed unlocking of mutex in TCP_output. git-svn-id: svn://kolibrios.org@3289 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/tcp_output.inc | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/kernel/branches/net/network/tcp_output.inc b/kernel/branches/net/network/tcp_output.inc index ccb7c696fe..ec0155e2d5 100644 --- a/kernel/branches/net/network/tcp_output.inc +++ b/kernel/branches/net/network/tcp_output.inc @@ -289,6 +289,8 @@ TCP_output: call mutex_unlock popa +; Fixme: returnvalue? + ret @@ -533,10 +535,6 @@ TCP_send: TCP_checksum (eax + IP_SOCKET.LocalIP), (eax + IP_SOCKET.RemoteIP) mov [esi + TCP_header.Checksum], dx -; unlock socket - lea ecx, [eax + SOCKET.mutex] - call mutex_unlock - ;---------------- ; Send the packet @@ -552,10 +550,6 @@ TCP_send: inc [TCP_segments_tx] ; FIXME: correct interface? -; unlock socket - lea ecx, [eax + SOCKET.mutex] - call mutex_lock - ; update advertised receive window test ecx, ecx jz @f @@ -572,12 +566,19 @@ TCP_send: ; and flags and [eax + TCP_SOCKET.t_flags], not (TF_ACKNOW + TF_DELACK) - test [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT - jnz TCP_output.again - +;-------------- ; unlock socket + + push eax lea ecx, [eax + SOCKET.mutex] call mutex_unlock + pop eax + +;----------------------------- +; Check if we need more output + + test [eax + TCP_SOCKET.temp_bits], TCP_BIT_SENDALOT + jnz TCP_output.again DEBUGF 1,"TCP_send: success!\n" @@ -593,7 +594,6 @@ TCP_send: mov [eax + TCP_SOCKET.timer_retransmission], TCP_time_re_min -; unlock socket lea ecx, [eax + SOCKET.mutex] call mutex_unlock @@ -602,9 +602,13 @@ TCP_send: or eax, -1 ret + .send_error: add esp, 8 + lea ecx, [eax + SOCKET.mutex] + call mutex_unlock + DEBUGF 1,"TCP_send: sending failed\n" or eax, -2