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;
|
nb = EVENTSIZE - partial;
|
||||||
|
|
||||||
/* fill buffer */
|
/* fill buffer */
|
||||||
ep = e[n % nelem(e)];
|
ep = e[n++ % nelem(e)];
|
||||||
memmove(ep->b+partial, s, nb);
|
memmove(ep->b+partial, s, nb);
|
||||||
partial += nb;
|
partial += nb;
|
||||||
s += nb;
|
s += nb;
|
||||||
|
@ -118,19 +118,16 @@ fswrite(Req *r)
|
||||||
ep->nb += wid;
|
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 */
|
/* send buffer when not empty */
|
||||||
if(ep->nb > 0){
|
if(ep->nb > 0){
|
||||||
ep->b[ep->nb] = '\0';
|
ep->b[ep->nb] = '\0';
|
||||||
sendp(win->cevent, ep);
|
sendp(win->cevent, ep);
|
||||||
recvp(writechan);
|
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;
|
r->ofcall.count = r->ifcall.count;
|
||||||
|
|
Loading…
Reference in a new issue