From 7b10f06b0061b894a1f6a1320c8e8c468d93b23b Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Thu, 8 Jan 2015 23:32:03 +0000 Subject: [PATCH] SOCKET_receive: generate a new network event when we expect the caller to call back later. git-svn-id: svn://kolibrios.org@5364 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/network/socket.inc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel/trunk/network/socket.inc b/kernel/trunk/network/socket.inc index f285f7c524..cb232b1aa5 100644 --- a/kernel/trunk/network/socket.inc +++ b/kernel/trunk/network/socket.inc @@ -754,7 +754,7 @@ SOCKET_receive: pop edi test [eax + SOCKET.state], SS_CANTRCVMORE - jnz .return + jnz .last_data cmp ebx, EWOULDBLOCK jne .return @@ -779,6 +779,11 @@ SOCKET_receive: mov [esp+32], ecx ret + .last_data: + test ecx, ecx + jz .return + call SOCKET_notify + jmp .return @@ -874,6 +879,13 @@ SOCKET_receive_stream: call SOCKET_ring_free ; free read memory pop eax + cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0 + jne .more_data + xor ebx, ebx ; errorcode = 0 (no error) + ret + + .more_data: + call SOCKET_notify ; Queue another network event xor ebx, ebx ; errorcode = 0 (no error) ret