diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/libventi/hangup.c |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/libventi/hangup.c')
-rwxr-xr-x | sys/src/libventi/hangup.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/src/libventi/hangup.c b/sys/src/libventi/hangup.c new file mode 100755 index 000000000..365baf1da --- /dev/null +++ b/sys/src/libventi/hangup.c @@ -0,0 +1,31 @@ +#include <u.h> +#ifdef PLAN9PORT +#include <sys/socket.h> +#endif +#include <libc.h> +#include <venti.h> +#include "queue.h" + +void +vthangup(VtConn *z) +{ + qlock(&z->lk); + z->state = VtStateClosed; +#ifdef PLAN9PORT + /* try to make the read in vtrecvproc fail */ + shutdown(SHUT_WR, z->infd); + shutdown(SHUT_WR, z->outfd); +#endif + if(z->infd >= 0) + close(z->infd); + if(z->outfd >= 0 && z->outfd != z->infd) + close(z->outfd); + z->infd = -1; + z->outfd = -1; + if(z->writeq) + _vtqhangup(z->writeq); + if(z->readq) + _vtqhangup(z->readq); + qunlock(&z->lk); +} + |