Experimental support for MSG_PEEK and MSG_DONTWAIT in SOCKET_receive_stream.

git-svn-id: svn://kolibrios.org@3459 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr
2013-04-09 10:47:23 +00:00
parent 8b12b27e11
commit 1fc22f7bce
2 changed files with 23 additions and 0 deletions

View File

@@ -848,12 +848,20 @@ SOCKET_receive_stream:
DEBUGF 1,"SOCKET_receive: STREAM\n"
mov ebx, edi
mov ecx, esi
mov edi, edx
xor edx, edx
test ebx, MSG_DONTWAIT
jnz .dontwait
.loop:
cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
je .block
.dontwait:
test ebx, MSG_PEEK
jnz .peek
add eax, STREAM_SOCKET.rcv
call SOCKET_ring_read
call SOCKET_ring_free
@@ -861,6 +869,11 @@ SOCKET_receive_stream:
mov [esp+32], ecx ; return number of bytes copied
ret
.peek:
mov ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size]
mov [esp+32], ecx ; return number of bytes available
ret
.block:
test [eax + SOCKET.options], SO_NONBLOCK
jnz s_error