acme/win: fix mistake
have to save partial reminder before null terminating current event buffer :)
This commit is contained in:
parent
6ddbe25d19
commit
f83dab12c6
1 changed files with 5 additions and 8 deletions
|
@ -94,7 +94,7 @@ fswrite(Req *r)
|
|||
nb = EVENTSIZE - partial;
|
||||
|
||||
/* fill buffer */
|
||||
ep = e[n % nelem(e)];
|
||||
ep = e[n++ % nelem(e)];
|
||||
memmove(ep->b+partial, s, nb);
|
||||
partial += nb;
|
||||
s += nb;
|
||||
|
@ -118,19 +118,16 @@ fswrite(Req *r)
|
|||
ep->nb += wid;
|
||||
}
|
||||
|
||||
/* put partial reminder onto next buffer */
|
||||
if(partial > 0)
|
||||
memmove(e[n % nelem(e)]->b, p, partial);
|
||||
|
||||
/* send buffer when not empty */
|
||||
if(ep->nb > 0){
|
||||
ep->b[ep->nb] = '\0';
|
||||
sendp(win->cevent, ep);
|
||||
recvp(writechan);
|
||||
}
|
||||
n++;
|
||||
|
||||
/* put partial reminder onto next buffer */
|
||||
if(partial > 0){
|
||||
ep = e[n % nelem(e)];
|
||||
memmove(ep->b, p, partial);
|
||||
}
|
||||
}
|
||||
|
||||
r->ofcall.count = r->ifcall.count;
|
||||
|
|
Loading…
Reference in a new issue