• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:connect +full:- +full:timeout

15   if (-1 == setsockopt(fd, level, opt, val, len)) perror_exit("setsockopt");  in xsetsockopt()
43 int fd = -1, one = 1; in xconnbind()
45 // Try all the returned addresses. Report errors if last entry can't connect. in xconnbind()
46 for (ai = ai_arg; ai; ai = ai->ai_next) { in xconnbind()
47 fd = (ai->ai_next ? socket : xsocket)(ai->ai_family, ai->ai_socktype, in xconnbind()
48 ai->ai_protocol); in xconnbind()
50 if (!(dobind ? bind : connect)(fd, ai->ai_addr, ai->ai_addrlen)) break; in xconnbind()
51 else if (!ai->ai_next) perror_exit_raw(dobind ? "bind" : "connect"); in xconnbind()
77 if (connect(fd, sa, len)) perror_exit("connect"); in xconnect()
80 int xpoll(struct pollfd *fds, int nfds, int timeout) in xpoll() argument
83 long long now, then = timeout>0 ? millitime() : 0; in xpoll()
86 if (0<=(i = poll(fds, nfds, timeout)) || toys.signal) return i; in xpoll()
90 timeout -= now-then; in xpoll()
97 // half-connection shutdown. timeouts return if no data for X ms.
98 // Returns 0: both closed, 1 shutdown_timeout, 2 timeout
101 int timeout, int shutdown_timeout) in pollinate() argument
113 if (!xpoll(pollfds, pollcount, timeout)) return pollcount; in pollinate()
125 // Close half-connection. This is needed for things like in pollinate()
127 // Note that in1 closing triggers timeout, in2 returns now. in pollinate()
130 pollcount--; in pollinate()
131 timeout = shutdown_timeout; in pollinate()
143 if (sa->sa_family == AF_INET) addr = &((struct sockaddr_in *)sa)->sin_addr; in ntop()
144 else addr = &((struct sockaddr_in6 *)sa)->sin6_addr; in ntop()
146 inet_ntop(sa->sa_family, addr, libbuf, sizeof(libbuf)); in ntop()
154 dest->sa_family == AF_INET ? sizeof(struct sockaddr_in) : in xsendto()
160 // xrecvfrom with timeout in milliseconds
161 int xrecvwait(int fd, char *buf, int len, union socksaddr *sa, int timeout) in xrecvwait() argument
165 if (timeout >= 0) { in xrecvwait()
170 if (!xpoll(&pfd, 1, timeout)) return 0; in xrecvwait()