start at 0 not b->next as e is already based on next not on 0

This commit is contained in:
leitner
2024-10-02 16:26:42 +00:00
parent 00851585d4
commit 03a85d6dc7

View File

@@ -11,7 +11,7 @@ int64 iob_write2(int64 s,io_batch* b,io_write_callback cb,io_sendfile_callback s
total=0;
if (!(e=array_get(&b->b,sizeof(iob_entry),b->next)))
return -3; /* can't happen error */
for (i=b->next; e+i<last; ++i) {
for (i=0; e+i<last; ++i) {
int thatsit;
if (!e[i].n) continue;
if (e[i].type==FROMFILE)
@@ -35,7 +35,7 @@ int64 iob_write2(int64 s,io_batch* b,io_write_callback cb,io_sendfile_callback s
}
++b->next;
}
if (total == b->bytesleft)
if (b->bytesleft == 0)
iob_reset(b);
return total;
}