Blob


1 #include <u.h>
2 #include <libc.h>
3 #include <venti.h>
4 #include "queue.h"
6 void
7 vthangup(VtConn *z)
8 {
9 qlock(&z->lk);
10 z->state = VtStateClosed;
11 if(z->infd >= 0)
12 close(z->infd);
13 if(z->outfd >= 0 && z->outfd != z->infd)
14 close(z->outfd);
15 z->infd = -1;
16 z->outfd = -1;
17 if(z->writeq)
18 _vtqhangup(z->writeq);
19 if(z->readq)
20 _vtqhangup(z->readq);
21 qunlock(&z->lk);
22 }