/[resiprocate]/main/contrib/ares/ares_fds.c
ViewVC logotype

Contents of /main/contrib/ares/ares_fds.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5295 - (show annotations) (download)
Mon Aug 22 00:30:05 2005 UTC (14 years, 2 months ago) by jason
File MIME type: text/plain
File size: 1494 byte(s)
merged 5270:HEAD from b-directory-reorg
1 /* Copyright 1998 by the Massachusetts Institute of Technology.
2 *
3 * Permission to use, copy, modify, and distribute this
4 * software and its documentation for any purpose and without
5 * fee is hereby granted, provided that the above copyright
6 * notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting
8 * documentation, and that the name of M.I.T. not be used in
9 * advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission.
11 * M.I.T. makes no representations about the suitability of
12 * this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
14 */
15
16
17 #include <sys/types.h>
18 //#include <sys/time.h>
19 #include "ares.h"
20 #include "ares_private.h"
21
22 int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
23 {
24 struct server_state *server;
25 int i, nfds;
26
27 /* No queries, no file descriptors. */
28 if (!channel->queries)
29 return 0;
30
31 nfds = 0;
32 for (i = 0; i < channel->nservers; i++)
33 {
34 server = &channel->servers[i];
35 if (server->udp_socket != -1)
36 {
37 FD_SET(server->udp_socket, read_fds);
38 if (server->udp_socket >= nfds)
39 nfds = server->udp_socket + 1;
40 }
41 if (server->tcp_socket != -1)
42 {
43 FD_SET(server->tcp_socket, read_fds);
44 if (server->qhead)
45 FD_SET(server->tcp_socket, write_fds);
46 if (server->tcp_socket >= nfds)
47 nfds = server->tcp_socket + 1;
48 }
49 }
50 return nfds;
51 }

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27