54,6 → 54,7 |
.SEG_LEN dd ? ; segment length |
.SEG_WND dd ? ; segment window |
.wndsizeTimer dd ? ; window size timer |
.lock dd ? ; lock mutex |
.rxData dd ? ; receive data buffer here |
ends |
|
600,15 → 601,18 |
or eax, eax |
jz .error |
|
lea ebx, [eax + SOCKET.lock] |
call wait_mutex |
|
mov ebx, eax |
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes |
test eax, eax |
jz .error |
jz .error_release |
|
dec eax |
mov esi, ebx ; esi is address of socket |
mov [ebx + SOCKET.rxDataCount], eax ; store new count |
movzx ebx, byte[ebx + SOCKET.rxData] ; get the byte |
movzx eax, byte[ebx + SOCKET.rxData] ; get the byte |
|
mov ecx, SOCKETBUFFSIZE - SOCKET.rxData - 1 |
lea edi, [esi + SOCKET.rxData] |
621,8 → 625,13 |
and ecx, 3 |
rep movsb |
|
mov [ebx + SOCKET.lock], 0 |
mov ebx, eax |
|
ret |
|
.error_release: |
mov [ebx + SOCKET.lock], 0 |
.error: |
xor ebx, ebx |
ret |
645,6 → 654,9 |
or eax, eax |
jz .error |
|
lea ebx, [eax + SOCKET.lock] |
call wait_mutex |
|
mov ebx, eax |
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes |
test eax, eax ; if count of bytes is zero.. |
675,6 → 687,7 |
rep movsb ; copy remaining bytes |
|
.exit: |
mov [ebx + SOCKET.lock], 0 |
ret ; at last, exit |
|
.error: |
685,6 → 698,7 |
xor esi, esi |
mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero) |
call .start_copy |
mov [ebx + SOCKET.lock], 0 |
ret |
|
.start_copy: |