aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-04 22:20:52 +0000
committerrsc <devnull@localhost>2005-01-04 22:20:52 +0000
commitd165fa680cba59b60cbe1fe4a0fa8aac92fdef67 (patch)
tree428f9d9aaf1dc6104ceb31055eb4b070f056b457 /src
parent7e19561a6c511205d64667bb3bf89842678c6f96 (diff)
downloadplan9port-d165fa680cba59b60cbe1fe4a0fa8aac92fdef67.tar.gz
plan9port-d165fa680cba59b60cbe1fe4a0fa8aac92fdef67.tar.bz2
plan9port-d165fa680cba59b60cbe1fe4a0fa8aac92fdef67.zip
do not free r until done with it!
Diffstat (limited to 'src')
-rw-r--r--src/libmux/mux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libmux/mux.c b/src/libmux/mux.c
index a3ea6722..c225d86b 100644
--- a/src/libmux/mux.c
+++ b/src/libmux/mux.c
@@ -49,6 +49,7 @@ muxrpc(Mux *mux, void *tx)
/* actually send the packet */
if(tag < 0 || mux->settag(mux, tx, tag) < 0 || _muxsend(mux, tx) < 0){
qlock(&mux->lk);
+ dequeue(mux, r);
puttag(mux, r);
qunlock(&mux->lk);
return nil;
@@ -85,14 +86,13 @@ muxrpc(Mux *mux, void *tx)
continue;
}
r2 = mux->wait[tag];
- if(r2 == nil){
+ if(r2 == nil || r2->prev == nil){
fprint(2, "%s: bad rpc tag %ux (no one waiting on that tag)\n", argv0, tag);
/* must leak packet! don't know how to free it! */
continue;
}
r2->p = p;
dequeue(mux, r2);
- puttag(mux, r2);
rwakeup(&r2->r);
}
mux->muxer = 0;
@@ -103,6 +103,7 @@ muxrpc(Mux *mux, void *tx)
}
//print("finished %p\n", r);
p = r->p;
+ puttag(mux, r);
qunlock(&mux->lk);
return p;
}