Rev 4056 | Rev 4339 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4056 | Rev 4219 | ||
---|---|---|---|
Line 753... | Line 753... | ||
753 | .loop: |
753 | .loop: |
754 | push edi |
754 | push edi |
755 | call [eax + SOCKET.rcv_proc] |
755 | call [eax + SOCKET.rcv_proc] |
756 | pop edi |
756 | pop edi |
Line -... | Line 757... | ||
- | 757 | ||
- | 758 | test [eax + SOCKET.state], SS_CANTRCVMORE |
|
- | 759 | jnz .return |
|
757 | 760 | ||
758 | cmp ebx, EWOULDBLOCK |
761 | cmp ebx, EWOULDBLOCK |
Line 759... | Line 762... | ||
759 | jne .return |
762 | jne .return |
760 | 763 | ||
Line 761... | Line -... | ||
761 | test edi, MSG_DONTWAIT |
- | |
762 | jnz .return_err |
- | |
763 | - | ||
764 | test [eax + SOCKET.state], SS_CANTRCVMORE |
764 | test edi, MSG_DONTWAIT |
765 | jnz .return_err |
765 | jnz .return_err |
Line 766... | Line 766... | ||
766 | 766 | ||
767 | ; test [eax + SOCKET.options], SO_NONBLOCK |
767 | ; test [eax + SOCKET.options], SO_NONBLOCK |
Line 773... | Line 773... | ||
773 | 773 | ||
774 | .invalid: |
774 | .invalid: |
775 | push EINVAL |
775 | push EINVAL |
776 | pop ebx |
776 | pop ebx |
777 | .return_err: |
777 | .return_err: |
778 | mov eax, -1 |
778 | mov ecx, -1 |
779 | .return: |
779 | .return: |
780 | mov [esp+20], ebx |
780 | mov [esp+20], ebx |
781 | mov [esp+32], eax |
781 | mov [esp+32], ecx |
Line 797... | Line 797... | ||
797 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx |
797 | DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_receive: %u bytes data\n", ecx |
Line 798... | Line 798... | ||
798 | 798 | ||
799 | cmp ecx, ebx ; If data segment does not fit in applications buffer, abort |
799 | cmp ecx, ebx ; If data segment does not fit in applications buffer, abort |
Line 800... | Line 800... | ||
800 | ja .too_small |
800 | ja .too_small |
801 | 801 | ||
802 | push ecx |
802 | push eax ecx |
803 | push [esi + socket_queue_entry.buf_ptr] ; save the buffer addr so we can clear it later |
803 | push [esi + socket_queue_entry.buf_ptr] ; save the buffer addr so we can clear it later |
Line 804... | Line 804... | ||
804 | mov esi, [esi + socket_queue_entry.data_ptr] |
804 | mov esi, [esi + socket_queue_entry.data_ptr] |
Line 818... | Line 818... | ||
818 | jz .nd |
818 | jz .nd |
819 | rep movsd |
819 | rep movsd |
820 | .nd: |
820 | .nd: |
Line 821... | Line 821... | ||
821 | 821 | ||
822 | call NET_packet_free |
822 | call NET_packet_free |
823 | pop eax ; return number of bytes copied to application |
823 | pop ecx eax ; return number of bytes copied to application |
824 | xor ebx, ebx |
824 | xor ebx, ebx |
Line 825... | Line 825... | ||
825 | ret |
825 | ret |
826 | 826 | ||
827 | .too_small: |
827 | .too_small: |
828 | mov eax, -1 |
828 | mov ecx, -1 |
829 | push EMSGSIZE |
829 | push EMSGSIZE |
Line 830... | Line 830... | ||
830 | pop ebx |
830 | pop ebx |
Line 868... | Line 868... | ||
868 | 868 | ||
869 | mov ecx, esi |
869 | mov ecx, esi |
870 | mov edi, edx |
870 | mov edi, edx |
Line -... | Line 871... | ||
- | 871 | xor edx, edx |
|
871 | xor edx, edx |
872 | |
872 | 873 | push eax |
|
873 | add eax, STREAM_SOCKET.rcv |
874 | add eax, STREAM_SOCKET.rcv |
- | 875 | call SOCKET_ring_read ; copy data from kernel buffer to application buffer |
|
Line 874... | Line -... | ||
874 | call SOCKET_ring_read ; copy data from kernel buffer to application buffer |
- | |
875 | call SOCKET_ring_free ; free read memory |
876 | call SOCKET_ring_free ; free read memory |
876 | 877 | pop eax |
|
Line 877... | Line 878... | ||
877 | mov eax, ecx ; return number of bytes copied |
878 | |
878 | xor ebx, ebx ; errorcode = 0 (no error) |
879 | xor ebx, ebx ; errorcode = 0 (no error) |
879 | ret |
880 | ret |
- | 881 | ||
880 | 882 | .wouldblock: |
|
Line 881... | Line 883... | ||
881 | .wouldblock: |
883 | push EWOULDBLOCK |
882 | push EWOULDBLOCK |
884 | pop ebx |
883 | pop ebx |
885 | xor ecx, ecx |
884 | ret |
886 | ret |
Line 885... | Line 887... | ||
885 | 887 | ||
Line 2081... | Line 2083... | ||
2081 | 2083 | ||
2082 | .next_socket: |
2084 | .next_socket: |
2083 | mov eax, [eax + SOCKET.NextPtr] |
2085 | mov eax, [eax + SOCKET.NextPtr] |
2084 | or eax, eax |
2086 | or eax, eax |
- | 2087 | jz .error |
|
2085 | jz .error |
2088 | diff16 "tetten", 0, $ |
2086 | cmp [eax + SOCKET.Number], ecx |
2089 | cmp [eax + SOCKET.Number], ecx |
Line 2087... | Line 2090... | ||
2087 | jne .next_socket |
2090 | jne .next_socket |