Experiment: ignore double-responds.
Also allow nil string as empty string in readstr.
This commit is contained in:
parent
eb9be70308
commit
39e5957ace
2 changed files with 14 additions and 3 deletions
|
|
@ -755,6 +755,11 @@ respond(Req *r, char *error)
|
||||||
srv = r->srv;
|
srv = r->srv;
|
||||||
assert(srv != nil);
|
assert(srv != nil);
|
||||||
|
|
||||||
|
if(r->responded){
|
||||||
|
assert(r->pool);
|
||||||
|
goto free;
|
||||||
|
}
|
||||||
|
|
||||||
assert(r->responded == 0);
|
assert(r->responded == 0);
|
||||||
r->error = error;
|
r->error = error;
|
||||||
|
|
||||||
|
|
@ -806,13 +811,16 @@ if(chatty9p)
|
||||||
sysfatal("lib9p srv: write %d returned %d on fd %d: %r", n, m, srv->outfd);
|
sysfatal("lib9p srv: write %d returned %d on fd %d: %r", n, m, srv->outfd);
|
||||||
qunlock(&srv->wlock);
|
qunlock(&srv->wlock);
|
||||||
|
|
||||||
|
free:
|
||||||
qlock(&r->lk); /* no one will add flushes now */
|
qlock(&r->lk); /* no one will add flushes now */
|
||||||
r->responded = 1;
|
r->responded = 1;
|
||||||
qunlock(&r->lk);
|
|
||||||
|
|
||||||
for(i=0; i<r->nflush; i++)
|
for(i=0; i<r->nflush; i++)
|
||||||
respond(r->flush[i], nil);
|
respond(r->flush[i], nil);
|
||||||
free(r->flush);
|
free(r->flush);
|
||||||
|
r->nflush = 0;
|
||||||
|
r->flush = nil;
|
||||||
|
qunlock(&r->lk);
|
||||||
|
|
||||||
if(r->pool)
|
if(r->pool)
|
||||||
closereq(r);
|
closereq(r);
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,8 @@ readbuf(Req *r, void *s, long n)
|
||||||
void
|
void
|
||||||
readstr(Req *r, char *s)
|
readstr(Req *r, char *s)
|
||||||
{
|
{
|
||||||
|
if(s == nil)
|
||||||
|
r->ofcall.count = 0;
|
||||||
|
else
|
||||||
readbuf(r, s, strlen(s));
|
readbuf(r, s, strlen(s));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue