Bugfix in downloader (when socket recv function returns 0, it means remote end closed the connection.)

git-svn-id: svn://kolibrios.org@4345 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-12-12 12:14:39 +00:00
parent 5e7711d4f6
commit 4565216705

View File

@ -369,9 +369,9 @@ read_incoming_data:
.read: .read:
mcall recv, [socketnum], [pos], BUFFERSIZE, 0 mcall recv, [socketnum], [pos], BUFFERSIZE, 0
inc eax ; -1 = error (socket closed?) inc eax ; -1 = error (socket closed?)
jz .error
dec eax ; 0 bytes means the remote end closed the connection
jz .no_more_data jz .no_more_data
dec eax ; 0 bytes...
jz .read
DEBUGF 1, "Got chunk of %u bytes\n", eax DEBUGF 1, "Got chunk of %u bytes\n", eax
@ -384,6 +384,9 @@ read_incoming_data:
; TODO: parse header and resize buffer only once ; TODO: parse header and resize buffer only once
pop eax pop eax
jmp .read jmp .read
.error:
DEBUGF 1, "Socket error: %u\n", ebx
.no_more_data: .no_more_data:
mov eax, [buf_ptr] mov eax, [buf_ptr]