mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
add network dialing
This commit is contained in:
parent
8baa0cbdff
commit
9a4289cfdc
1 changed files with 29 additions and 0 deletions
|
@ -343,3 +343,32 @@ threadwrite(int fd, const void *a, long n)
|
|||
return tot;
|
||||
}
|
||||
|
||||
int
|
||||
threadannounce(char *addr, char *dir)
|
||||
{
|
||||
return p9announce(addr, dir);
|
||||
}
|
||||
|
||||
int
|
||||
threadlisten(char *dir, char *newdir)
|
||||
{
|
||||
int fd, ret;
|
||||
extern int _p9netfd(char*);
|
||||
|
||||
fd = _p9netfd(dir);
|
||||
if(fd < 0){
|
||||
werrstr("bad 'directory' in listen: %s", dir);
|
||||
return -1;
|
||||
}
|
||||
threadfdnoblock(fd);
|
||||
while((ret = p9listen(dir, newdir)) < 0 && errno==EAGAIN)
|
||||
_threadfdwait(fd, 'r', getcallerpc(&dir));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
threadaccept(int cfd, char *dir)
|
||||
{
|
||||
return p9accept(cfd, dir);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue