Rev 3556 | Rev 3600 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3556 | Rev 3565 | ||
---|---|---|---|
Line 770... | Line 770... | ||
770 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: socknum=%u bufaddr=%x buflength=%u flags=%x\n", ecx, edx, esi, edi |
770 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: socknum=%u bufaddr=%x buflength=%u flags=%x\n", ecx, edx, esi, edi |
Line 771... | Line 771... | ||
771 | 771 | ||
772 | call SOCKET_num_to_ptr |
772 | call SOCKET_num_to_ptr |
Line 773... | Line 773... | ||
773 | jz s_error |
773 | jz s_error |
- | 774 | ||
- | 775 | call [eax + SOCKET.rcv_proc] |
|
- | 776 | ||
Line 774... | Line 777... | ||
774 | 777 | mov [esp+32], eax |
|
775 | jmp [eax + SOCKET.rcv_proc] |
778 | ret |
Line 790... | Line 793... | ||
790 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx |
793 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx |
Line 791... | Line 794... | ||
791 | 794 | ||
792 | cmp ecx, ebx |
795 | cmp ecx, ebx |
Line -... | Line 796... | ||
- | 796 | ja .too_small |
|
793 | ja .too_small |
797 | |
794 | 798 | push ecx |
|
795 | push [esi + socket_queue_entry.buf_ptr] ; save the buffer addr so we can clear it later |
799 | push [esi + socket_queue_entry.buf_ptr] ; save the buffer addr so we can clear it later |
796 | mov esi, [esi + socket_queue_entry.data_ptr] |
- | |
Line 797... | Line 800... | ||
797 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi |
800 | mov esi, [esi + socket_queue_entry.data_ptr] |
798 | mov [esp+32+4], ecx ; return number of bytes copied |
801 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Source buffer=%x real addr=%x\n", [esp], esi |
799 | 802 | ||
800 | ; copy the data |
803 | ; copy the data |
Line 810... | Line 813... | ||
810 | jz .nd |
813 | jz .nd |
811 | rep movsd |
814 | rep movsd |
812 | .nd: |
815 | .nd: |
Line 813... | Line 816... | ||
813 | 816 | ||
- | 817 | call kernel_free ; remove the packet |
|
- | 818 | pop eax |
|
814 | call kernel_free ; remove the packet |
819 | |
Line 815... | Line 820... | ||
815 | ret |
820 | ret |
Line 816... | Line 821... | ||
816 | 821 | ||
- | 822 | .too_small: |
|
817 | .too_small: |
823 | |
- | 824 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Buffer too small\n" |
|
Line 818... | Line 825... | ||
818 | 825 | .fail: |
|
819 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: Buffer too small\n" |
826 | mov eax, -1 |
820 | jmp s_error |
827 | ret |
Line 821... | Line 828... | ||
821 | 828 | ||
822 | .block: |
829 | .block: |
Line 864... | Line 871... | ||
864 | 871 | ||
865 | add eax, STREAM_SOCKET.rcv |
872 | add eax, STREAM_SOCKET.rcv |
866 | call SOCKET_ring_read |
873 | call SOCKET_ring_read |
Line 867... | Line 874... | ||
867 | call SOCKET_ring_free |
874 | call SOCKET_ring_free |
868 | 875 | ||
Line 869... | Line 876... | ||
869 | mov [esp+32], ecx ; return number of bytes copied |
876 | mov eax, ecx ; return number of bytes copied |
870 | ret |
877 | ret |
871 | - | ||
872 | .peek: |
878 | |
Line 873... | Line 879... | ||
873 | mov ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size] |
879 | .peek: |
874 | mov [esp+32], ecx ; return number of bytes available |
880 | mov eax, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size] |
875 | ret |
881 | ret |
Line 876... | Line 882... | ||
876 | 882 | ||
877 | .block: |
883 | .block: |
Line 878... | Line 884... | ||
878 | test [eax + SOCKET.options], SO_NONBLOCK |
884 | test [eax + SOCKET.options], SO_NONBLOCK |
- | 885 | jnz .return0 |
|
- | 886 | ||
- | 887 | call SOCKET_block |
|
879 | jnz .return0 |
888 | jmp .loop |
- | 889 | ||
- | 890 | .return0: |
|
- | 891 | test [eax + SOCKET.options], SS_CANTRCVMORE |
|
- | 892 | jz .ok |
|
880 | 893 | ||
881 | call SOCKET_block |
894 | xor eax, eax |
Line 882... | Line 895... | ||
882 | jmp .loop |
895 | dec eax |
883 | 896 | ret |
|
Line 2259... | Line 2272... | ||
2259 | 2272 | ||
Line 2260... | Line 2273... | ||
2260 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_recv_more: %x\n", eax |
2273 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_recv_more: %x\n", eax |
Line -... | Line 2274... | ||
- | 2274 | ||
- | 2275 | or [eax + SOCKET.options], SS_CANTRCVMORE |
|
2261 | 2276 | ||
Line 2262... | Line 2277... | ||
2262 | or [eax + SOCKET.options], SS_CANTRCVMORE |
2277 | call SOCKET_notify |
Line 2278... | Line 2293... | ||
2278 | SOCKET_cant_send_more: |
2293 | SOCKET_cant_send_more: |
Line 2279... | Line 2294... | ||
2279 | 2294 | ||
Line 2280... | Line 2295... | ||
2280 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_send_more: %x\n", eax |
2295 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_cant_send_more: %x\n", eax |
- | 2296 | ||
- | 2297 | or [eax + SOCKET.options], SS_CANTSENDMORE |
|
- | 2298 | mov [eax + SOCKET.snd_proc], s_error |
|
Line 2281... | Line 2299... | ||
2281 | 2299 | ||
2282 | or [eax + SOCKET.options], SS_CANTSENDMORE |
2300 | call SOCKET_notify |