Yang Tse
8f0bef2fa0
Renamed internal function to avoid a variable shadowing it
2007-10-18 17:17:18 +00:00
Gisle Vanem
59136ece19
'FD_CLOXEC' is meaningless on MSDOS/Watt-32.
2007-10-08 14:38:51 +00:00
Steinar H. Gunderson
91b38857ef
Removed a piece of redundant code (process_answer already takes care of it).
2007-10-04 08:12:12 +00:00
Yang Tse
38dd0ede9d
Fix compiler warning
2007-09-30 19:43:23 +00:00
Yang Tse
62c264bcdb
check availability of <netinet/tcp.h>
2007-09-30 02:12:11 +00:00
Steinar H. Gunderson
84fcff79f4
Use ISDIGIT instead of isdigit; fixes a gcc warning.
2007-09-29 21:57:05 +00:00
Steinar H. Gunderson
23f5d145ec
Previously, processing a large batch of timeouts was O(n^2) in the number of
...
outstanding queries, and processing a DNS response packet was O(n) in the
number of outstanding queries. To speed things up in Google, we added a few circular,
doubly-linked lists of queries that are hash-bucketed based on
the attributes we care about, so most important operations are now O(1).
It might be that the number of buckets are higher than most people would need,
but on a quick calculation it should only be 100kB or so even on a 64-bit
system, so I've let it stay as-is.
2007-09-29 18:18:47 +00:00
Gisle Vanem
7a7f490efa
Fix compiler warning in setsockopt().
2007-09-29 14:34:59 +00:00
Steinar H. Gunderson
95c15fce0c
TCP queries can time out too, not just UDP queries. (Patch from the Google tree.)
2007-09-29 14:25:14 +00:00
Steinar H. Gunderson
c788efffd4
Read and process as many packets as possible in read_udp_packets, to avoid having to run the entire event loop once per packet. (Patch from the Google tree.)
2007-09-29 14:21:47 +00:00
Steinar H. Gunderson
c1a475e708
There are two different places in write_tcp_data() that advance the send_queue; however, they are slightly different and only the first one properly uses a while loop. Consolidate both into a single function that DTTR. (Patch from the Google tree.)
2007-09-29 14:09:14 +00:00
Steinar H. Gunderson
63ac6156aa
Forgot to include a few hunks from ares_process.c earlier. Fixing now.
2007-09-28 15:51:00 +00:00
Steinar H. Gunderson
08a70d117c
Support a few more socket options, and refactor the option setting a bit. (Patch from the Google tree.)
2007-09-28 15:15:39 +00:00
Steinar H. Gunderson
6ce589c3ee
Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.)
2007-09-28 14:46:51 +00:00
Steinar H. Gunderson
d426c20c0a
Three fixes in one commit (sorry): a) Take care of the tcpbuf if it ends while queued for transmission, note broken servers and close them in the main loop, and store TCP socket generation number in order not to send the same query twice over the same socket.
2007-09-28 14:28:14 +00:00
Steinar H. Gunderson
54ca7d8cb2
Don't skip a server if it's the only one. (Bugfix from the Google tree.)
2007-09-28 14:26:11 +00:00
Daniel Stenberg
015fc6aa17
wrong, revert the previous "fix" and instead check that the fd_set pointer
...
is non-NULL before we FD_CLR
2007-09-27 12:04:56 +00:00
Daniel Stenberg
a739b9bc45
eek, fix the conditions to return on either problem instead of requiring
...
both to occur
2007-09-27 12:02:15 +00:00
Daniel Stenberg
0f4664d27f
Steinar H. Gunderson fixed: Correctly clear sockets from the fd_set on in
...
several functions (write_tcp_data, read_tcp_data, read_udp_packets) so that
if it fails and the socket is closed the following code doesn't try to use
the file descriptor.
2007-09-22 21:23:10 +00:00
Daniel Stenberg
0f89a2e639
Steinar H. Gunderson modified c-ares to now also do to DNS retries even when
...
TCP is used since there are several edge cases where it still makes sense.
2007-09-22 21:04:16 +00:00
Daniel Stenberg
88ce03e945
Vlad Dinulescu fixed two outstanding valgrind reports
2007-07-14 13:08:50 +00:00
Daniel Stenberg
b084dc8760
Brad House fixed VS2005 compiler warnings due to time_t being 64bit.
...
He also made recent Microsoft compilers use _strdup() instead of strdup().
2007-06-02 19:48:29 +00:00
Daniel Stenberg
670273968c
added ares_process_fd() to allow applications to ask for processing on
...
specific sockets and thus avoiding select() and associated functions/macros.
This function will be used by upcoming libcurl releases for this very
reason. It also made me export the ares_socket_t type in the public ares.h
header file, since ares_process_fd() uses that type for two of the arguments.
2007-05-30 12:58:47 +00:00
Gisle Vanem
ee1235a7cd
Removed inclusion of <sys/types.h> in .c-files
...
since it's already included through "setup.h".
2007-02-26 04:33:19 +00:00
Yang Tse
69565afab0
Check for stdbool.h at configuration stage, and include it if available.
...
Check for lowercase 'bool' type at configuration stage. If not available
provide a suitable replacement with a type definition of 'unsigned char'
in setup_once.h
Move definitions of TRUE and FALSE to setup_once.h
2007-02-22 02:51:54 +00:00
Yang Tse
059b57677c
use macros ERRNO, SET_ERRNO(), SOCKERRNO and SET_SOCKERRNO() for errno handling
2007-02-16 15:04:44 +00:00
Gisle Vanem
5446ed4733
Use correct 3rd argument for ioctlsocket() under Watt-32.
2007-02-04 13:34:34 +00:00
Yang Tse
d2dd3d7e16
compiler warning fix
2007-02-01 15:36:56 +00:00
Yang Tse
5450db9151
Compiler warning fix
2006-10-25 10:25:43 +00:00
Yang Tse
5df4be1165
Check for USE_WINSOCK instead of WIN32 where the check was done
...
to verify winsock API availability.
2006-10-18 21:05:40 +00:00
Daniel Stenberg
7c621cfbdf
Brad Spencer did
...
o made ares_version.h use extern "C" for c++ compilers
o fixed compiler warnings in ares_getnameinfo.c
o fixed a buffer position init for TCP reads
2006-08-29 15:17:47 +00:00
Yang Tse
aa791ee5cf
Fix compiler warnings.
2006-07-29 09:15:03 +00:00
Yang Tse
2c81bfead5
Replace send() and recv() with swrite() and sread() macros.
2006-07-28 18:01:23 +00:00
Gisle Vanem
93858efe73
2nd try adding CVS id.
2006-07-22 15:37:10 +00:00
Yang Tse
bd8d4637a3
Fix compiler warning
2006-07-14 11:04:19 +00:00
William Ahern
4524618bf2
Handle EAGAIN/EWOULDBLOCK readiness errors, which can occur for both TCP and
...
UDP even when a poll(2) or select(2) suggest otherwise.
2006-06-19 01:18:05 +00:00
Daniel Stenberg
dd06c60ada
Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes
...
c-ares call a callback on socket state changes. A better way than the
ares_getsock() to get full control over the socket state.
2006-05-03 06:11:44 +00:00
Gisle Vanem
f1f32477e3
Changes for PellesC for Win32. It needs <unistd.h> for 'ssize_t'. Hence the
...
rearrangement in ares_process.c.
2005-12-20 20:48:38 +00:00
Yang Tse
4f69318e12
Fix compiler warning
2005-12-09 21:09:21 +00:00
Daniel Stenberg
b97e7fc730
read_tcp_data() fix to get the proper buffer pointer and size
2005-11-25 22:23:28 +00:00
Daniel Stenberg
fec632e948
Yang Tse: fixed compiler warnings
2005-11-25 22:14:53 +00:00
Gunter Knauf
8b571fbbb1
make ares compile again for NetWare.
2005-08-10 17:03:53 +00:00
Daniel Stenberg
40eb7d0d48
FIONBIO is in sys/ioctl.h on AIX
2005-06-03 07:39:18 +00:00
Daniel Stenberg
1dcb2b7e65
sigh, define TRUE if not already
2005-06-02 21:10:21 +00:00
Daniel Stenberg
5470b9aa73
William Ahern:
...
Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a
read event can come back from poll() on a valid SOCK_DGRAM socket but
recv(2) will still block. This patch doesn't ignore EAGAIN in
read_udp_packets(), though maybe it should. (This patch was edited by Daniel
Stenberg and a new configure test was added (imported from curl's configure)
to properly detect what non-blocking socket approach to use.)
2005-06-02 11:58:04 +00:00
Daniel Stenberg
993600761f
Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac OS
...
X.
2005-04-06 22:27:42 +00:00
Gisle Vanem
13d40e33a4
Prevent gcc warning.
2005-03-13 09:21:54 +00:00
Daniel Stenberg
39af394a1c
removed tabs and trailing whitespace from source
2004-10-06 07:50:18 +00:00
Gisle Vanem
fa83a0573e
No WSAGetLastError() on Watt-32/DOS
2004-08-20 14:07:11 +00:00
Gisle Vanem
b17e32baa7
Changes for Watt-32 on Windows. I've assumed Configure
...
sets the required HAVE_xx defines for non-DOS/Win targets.
2004-08-20 13:45:26 +00:00