Lines Matching refs:serv
33 struct sock_server_bind *serv; member
71 struct sock_server_bind *serv, int fd, in server_add_state() argument
80 srvst->socks[n].serv = serv; in server_add_state()
93 srvst->socks[srvst->nfds].serv = serv; in server_add_state()
134 return server_add_state(srvst, server_io_cb, srvst->socks[idx].serv, in tcp_server_accept_cb()
204 if (srvst.fds[n].fd != -1 && srvst.socks[n].serv && in sock_server()
205 srvst.fds[n].fd != srvst.socks[n].serv->fd) { in sock_server()
232 struct sock_server_bind serv = { }; in sock_server_add_fd() local
241 serv.fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); in sock_server_add_fd()
242 if (serv.fd < 0) in sock_server_add_fd()
245 if (bind(serv.fd, ai->ai_addr, ai->ai_addrlen)) in sock_server_add_fd()
248 if (ai->ai_socktype == SOCK_STREAM && listen(serv.fd, 5)) in sock_server_add_fd()
251 if (getsockname(serv.fd, sa, &len)) in sock_server_add_fd()
257 serv.port = ntohs(sain->sin_port); in sock_server_add_fd()
261 serv.port = ntohs(sain6->sin6_port); in sock_server_add_fd()
266 if (!inet_ntop(sa->sa_family, src, serv.host, sizeof(serv.host))) in sock_server_add_fd()
274 p[ts->num_binds] = serv; in sock_server_add_fd()
278 if (close(serv.fd)) in sock_server_add_fd()
279 warn("sock_server_add_fd: close(%d)", serv.fd); in sock_server_add_fd()