Changes in net branch:

Fixed bug in socket_ring_write concerning very big numbers. 
Socket_send now returns number of sent bytes.

git-svn-id: svn://kolibrios.org@2573 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-04-05 16:23:47 +00:00
parent a268aaffd6
commit d0105fc6d5

View File

@ -799,9 +799,10 @@ SOCKET_send_udp:
DEBUGF 1,"SOCKET_send: UDP\n" DEBUGF 1,"SOCKET_send: UDP\n"
mov [esp+32], ecx
call UDP_output call UDP_output
cmp eax, -1
mov [esp+32], eax je s_error
ret ret
@ -813,11 +814,13 @@ SOCKET_send_tcp:
push eax push eax
add eax, STREAM_SOCKET.snd add eax, STREAM_SOCKET.snd
call SOCKET_ring_write call SOCKET_ring_write
mov [esp+32], ecx
pop eax pop eax
call TCP_output test ecx, ecx
jz s_error
mov [esp+32], eax call TCP_output
ret ret
@ -826,19 +829,22 @@ SOCKET_send_ip:
DEBUGF 1,"type: IP\n" DEBUGF 1,"type: IP\n"
mov [esp+32], ecx
call IPv4_output_raw call IPv4_output_raw
cmp eax, -1
mov [esp+32], eax je s_error
ret ret
align 4 align 4
SOCKET_send_icmp: SOCKET_send_icmp:
DEBUGF 1,"SOCKET_send: ICMP\n" DEBUGF 1,"SOCKET_send: ICMP\n"
mov [esp+32], ecx
call ICMP_output_raw call ICMP_output_raw
cmp eax, -1
mov [esp+32], eax je s_error
ret ret
@ -1136,6 +1142,7 @@ SOCKET_ring_write:
DEBUGF 1,"SOCKET_ring_write: ringbuff=%x ptr=%x size=%u\n", eax, esi, ecx DEBUGF 1,"SOCKET_ring_write: ringbuff=%x ptr=%x size=%u\n", eax, esi, ecx
add [eax + RING_BUFFER.size], ecx add [eax + RING_BUFFER.size], ecx
jc .way_too_large
cmp [eax + RING_BUFFER.size], SOCKET_MAXDATA cmp [eax + RING_BUFFER.size], SOCKET_MAXDATA
ja .too_large ja .too_large
@ -1174,14 +1181,21 @@ SOCKET_ring_write:
sub [eax + RING_BUFFER.size], SOCKET_MAXDATA sub [eax + RING_BUFFER.size], SOCKET_MAXDATA
sub ecx, [eax + RING_BUFFER.size] sub ecx, [eax + RING_BUFFER.size]
mov [eax + RING_BUFFER.size], SOCKET_MAXDATA mov [eax + RING_BUFFER.size], SOCKET_MAXDATA
ja .copy
test ecx, ecx .full:
jnz .copy
DEBUGF 2,"SOCKET_ring_write: ring buffer is full!\n" DEBUGF 2,"SOCKET_ring_write: ring buffer is full!\n"
xor ecx, ecx xor ecx, ecx
ret ret
.way_too_large:
sub [eax + RING_BUFFER.size], ecx
mov ecx, SOCKET_MAXDATA
sub ecx, [eax + RING_BUFFER.size]
ja .copy
jmp .full
;----------------------------------------------------------------- ;-----------------------------------------------------------------
; ;