forked from KolibriOS/kolibrios
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:
parent
8b12b27e11
commit
1fc22f7bce
@ -848,12 +848,20 @@ SOCKET_receive_stream:
|
|||||||
|
|
||||||
DEBUGF 1,"SOCKET_receive: STREAM\n"
|
DEBUGF 1,"SOCKET_receive: STREAM\n"
|
||||||
|
|
||||||
|
mov ebx, edi
|
||||||
mov ecx, esi
|
mov ecx, esi
|
||||||
mov edi, edx
|
mov edi, edx
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
|
|
||||||
|
test ebx, MSG_DONTWAIT
|
||||||
|
jnz .dontwait
|
||||||
.loop:
|
.loop:
|
||||||
cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
|
cmp [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
|
||||||
je .block
|
je .block
|
||||||
|
.dontwait:
|
||||||
|
test ebx, MSG_PEEK
|
||||||
|
jnz .peek
|
||||||
|
|
||||||
add eax, STREAM_SOCKET.rcv
|
add eax, STREAM_SOCKET.rcv
|
||||||
call SOCKET_ring_read
|
call SOCKET_ring_read
|
||||||
call SOCKET_ring_free
|
call SOCKET_ring_free
|
||||||
@ -861,6 +869,11 @@ SOCKET_receive_stream:
|
|||||||
mov [esp+32], ecx ; return number of bytes copied
|
mov [esp+32], ecx ; return number of bytes copied
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.peek:
|
||||||
|
mov ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size]
|
||||||
|
mov [esp+32], ecx ; return number of bytes available
|
||||||
|
ret
|
||||||
|
|
||||||
.block:
|
.block:
|
||||||
test [eax + SOCKET.options], SO_NONBLOCK
|
test [eax + SOCKET.options], SO_NONBLOCK
|
||||||
jnz s_error
|
jnz s_error
|
||||||
|
@ -83,6 +83,10 @@ SO_BINDTODEVICE = 1 shl 9
|
|||||||
SO_BLOCK = 1 shl 10 ; TO BE REMOVED
|
SO_BLOCK = 1 shl 10 ; TO BE REMOVED
|
||||||
SO_NONBLOCK = 1 shl 31
|
SO_NONBLOCK = 1 shl 31
|
||||||
|
|
||||||
|
; Socket flags for user calls
|
||||||
|
MSG_PEEK = 0x02
|
||||||
|
MSG_DONTWAIT = 0x40
|
||||||
|
|
||||||
; Socket level
|
; Socket level
|
||||||
SOL_SOCKET = 0
|
SOL_SOCKET = 0
|
||||||
|
|
||||||
@ -264,6 +268,12 @@ stack_handler:
|
|||||||
cmp [NET_RUNNING], 0
|
cmp [NET_RUNNING], 0
|
||||||
je .exit
|
je .exit
|
||||||
|
|
||||||
|
cmp [UDP_PACKETS_TX], 50
|
||||||
|
jb @f
|
||||||
|
DEBUGF 1, "\n\nCRAP!\n\n"
|
||||||
|
jmp $
|
||||||
|
@@:
|
||||||
|
|
||||||
; Test for 10ms tick
|
; Test for 10ms tick
|
||||||
mov eax, [timer_ticks]
|
mov eax, [timer_ticks]
|
||||||
cmp eax, [net_10ms]
|
cmp eax, [net_10ms]
|
||||||
|
Loading…
Reference in New Issue
Block a user