new venti library.
This commit is contained in:
parent
9df487d720
commit
056fe1ba7f
28 changed files with 4635 additions and 0 deletions
36
src/libventi/conn.c
Normal file
36
src/libventi/conn.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <venti.h>
|
||||
#include "queue.h"
|
||||
|
||||
VtConn*
|
||||
vtconn(int infd, int outfd)
|
||||
{
|
||||
VtConn *z;
|
||||
|
||||
z = vtmallocz(sizeof(VtConn));
|
||||
z->tagrend.l = &z->lk;
|
||||
z->rpcfork.l = &z->lk;
|
||||
z->infd = infd;
|
||||
z->outfd = outfd;
|
||||
z->part = packetalloc();
|
||||
return z;
|
||||
}
|
||||
|
||||
void
|
||||
vtfreeconn(VtConn *z)
|
||||
{
|
||||
vthangup(z);
|
||||
qlock(&z->lk);
|
||||
for(;;){
|
||||
if(z->readq)
|
||||
_vtqhangup(z->readq);
|
||||
else if(z->writeq)
|
||||
_vtqhangup(z->writeq);
|
||||
else
|
||||
break;
|
||||
rsleep(&z->rpcfork);
|
||||
}
|
||||
packetfree(z->part);
|
||||
vtfree(z);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue