Lines Matching refs:last_server
227 daemon->last_server = NULL;
265 else if (!(start = daemon->last_server) ||
470 /* sets new last_server */
540 struct server *last_server;
543 for (last_server = daemon->servers; last_server; last_server = last_server->next)
544 if (!(last_server->flags & (SERV_LITERAL_ADDRESS | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_NO_ADDR)) &&
545 sockaddr_isequal(&last_server->addr, &serveraddr))
547 server = last_server;
552 daemon->last_server = server;
736 struct server *last_server;
790 if (type != 0 || (daemon->options & OPT_ORDER) || !daemon->last_server)
791 last_server = daemon->servers;
793 last_server = daemon->last_server;
795 if (!flags && last_server)
806 firstsendto = last_server;
809 if (!(last_server = last_server->next))
810 last_server = daemon->servers;
812 if (last_server == firstsendto)
817 if (type != (last_server->flags & SERV_TYPE) ||
818 (type == SERV_HAS_DOMAIN && !hostname_isequal(domain, last_server->domain)))
821 if ((last_server->tcpfd == -1) &&
822 (last_server->tcpfd = socket(last_server->addr.sa.sa_family, SOCK_STREAM, 0)) != -1 &&
823 (!local_bind(last_server->tcpfd, &last_server->source_addr,
824 last_server->interface, last_server->mark, 1) ||
825 connect(last_server->tcpfd, &last_server->addr.sa, sa_len(&last_server->addr)) == -1))
827 close(last_server->tcpfd);
828 last_server->tcpfd = -1;
831 if (last_server->tcpfd == -1)
837 if (!read_write(last_server->tcpfd, &c1, 1, 0) ||
838 !read_write(last_server->tcpfd, &c2, 1, 0) ||
839 !read_write(last_server->tcpfd, packet, size, 0) ||
840 !read_write(last_server->tcpfd, &c1, 1, 1) ||
841 !read_write(last_server->tcpfd, &c2, 1, 1))
843 close(last_server->tcpfd);
844 last_server->tcpfd = -1;
849 if (!read_write(last_server->tcpfd, packet, m, 1))
854 if (last_server->addr.sa.sa_family == AF_INET)
856 (struct all_addr *)&last_server->addr.in.sin_addr, NULL);
860 (struct all_addr *)&last_server->addr.in6.sin6_addr, NULL);
870 m = process_reply(header, now, last_server, (unsigned int)m);
1068 if (daemon->last_server == server)
1069 daemon->last_server = NULL;