Subversion Repositories Kolibri OS

Rev

Rev 4101 | Rev 4431 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4101 Rev 4345
Line 367... Line 367...
367
        mov     eax, [buf_ptr]
367
        mov     eax, [buf_ptr]
368
        mov     [pos], eax
368
        mov     [pos], eax
369
  .read:
369
  .read:
370
        mcall   recv, [socketnum], [pos], BUFFERSIZE, 0
370
        mcall   recv, [socketnum], [pos], BUFFERSIZE, 0
371
        inc     eax             ; -1 = error (socket closed?)
371
        inc     eax             ; -1 = error (socket closed?)
-
 
372
        jz      .error
-
 
373
        dec     eax             ; 0 bytes means the remote end closed the connection
372
        jz      .no_more_data
374
        jz      .no_more_data
373
        dec     eax             ; 0 bytes...
-
 
374
        jz      .read
-
 
Line 375... Line 375...
375
 
375
 
Line 376... Line 376...
376
        DEBUGF  1, "Got chunk of %u bytes\n", eax
376
        DEBUGF  1, "Got chunk of %u bytes\n", eax
377
 
377
 
Line 383... Line 383...
383
        mcall   68, 20, , [buf_ptr]     ; reallocate memory block (make bigger)
383
        mcall   68, 20, , [buf_ptr]     ; reallocate memory block (make bigger)
384
        ; TODO: parse header and resize buffer only once
384
        ; TODO: parse header and resize buffer only once
385
        pop     eax
385
        pop     eax
386
        jmp     .read
386
        jmp     .read
Line -... Line 387...
-
 
387
 
-
 
388
  .error:
-
 
389
        DEBUGF  1, "Socket error: %u\n", ebx
387
        
390
        
388
  .no_more_data:
391
  .no_more_data:
389
        mov     eax, [buf_ptr]
392
        mov     eax, [buf_ptr]
Line 390... Line 393...
390
        sub     [pos], eax
393
        sub     [pos], eax