aboutsummaryrefslogtreecommitdiff
path: root/src/lib9p
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-05 15:34:18 +0000
committerrsc <devnull@localhost>2006-02-05 15:34:18 +0000
commit39e5957ace14f1dcff62014fd26f368e87c79c29 (patch)
tree4d84eaca1d4faf3fa78573cc43172afa60505baa /src/lib9p
parenteb9be70308f0397b13312e2472d7764d481e5a73 (diff)
downloadplan9port-39e5957ace14f1dcff62014fd26f368e87c79c29.tar.gz
plan9port-39e5957ace14f1dcff62014fd26f368e87c79c29.tar.bz2
plan9port-39e5957ace14f1dcff62014fd26f368e87c79c29.zip
Experiment: ignore double-responds.
Also allow nil string as empty string in readstr.
Diffstat (limited to 'src/lib9p')
-rw-r--r--src/lib9p/srv.c12
-rw-r--r--src/lib9p/util.c5
2 files changed, 14 insertions, 3 deletions
diff --git a/src/lib9p/srv.c b/src/lib9p/srv.c
index c8ca46e5..ec02c81f 100644
--- a/src/lib9p/srv.c
+++ b/src/lib9p/srv.c
@@ -755,6 +755,11 @@ respond(Req *r, char *error)
srv = r->srv;
assert(srv != nil);
+ if(r->responded){
+ assert(r->pool);
+ goto free;
+ }
+
assert(r->responded == 0);
r->error = error;
@@ -806,13 +811,16 @@ if(chatty9p)
sysfatal("lib9p srv: write %d returned %d on fd %d: %r", n, m, srv->outfd);
qunlock(&srv->wlock);
+free:
qlock(&r->lk); /* no one will add flushes now */
r->responded = 1;
- qunlock(&r->lk);
-
+
for(i=0; i<r->nflush; i++)
respond(r->flush[i], nil);
free(r->flush);
+ r->nflush = 0;
+ r->flush = nil;
+ qunlock(&r->lk);
if(r->pool)
closereq(r);
diff --git a/src/lib9p/util.c b/src/lib9p/util.c
index 17588a95..5b76f73a 100644
--- a/src/lib9p/util.c
+++ b/src/lib9p/util.c
@@ -21,5 +21,8 @@ readbuf(Req *r, void *s, long n)
void
readstr(Req *r, char *s)
{
- readbuf(r, s, strlen(s));
+ if(s == nil)
+ r->ofcall.count = 0;
+ else
+ readbuf(r, s, strlen(s));
}