Changelog for the c-ares project
+* Oct 21 2008 (Yang Tse)
+ Charles Hardin added handling of EINPROGRESS for UDP connects.
+
* Oct 18 2008 (Daniel Stenberg)
Charles Hardin made adig support a regular numerical dotted IP address for the
-s option as well.
/* Configure it. */
if (configure_socket(s, channel) < 0)
{
- close(s);
+ closesocket(s);
return -1;
}
if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
(void *)&opt, sizeof(opt)) == -1)
{
- close(s);
+ closesocket(s);
return -1;
}
sockin.sin_family = AF_INET;
sockin.sin_addr = server->addr;
sockin.sin_port = (unsigned short)(channel->tcp_port & 0xffff);
- if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1) {
- int err = SOCKERRNO;
+ if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1)
+ {
+ int err = SOCKERRNO;
- if (err != EINPROGRESS && err != EWOULDBLOCK) {
- closesocket(s);
- return -1;
+ if (err != EINPROGRESS && err != EWOULDBLOCK)
+ {
+ closesocket(s);
+ return -1;
+ }
}
- }
SOCK_STATE_CALLBACK(channel, s, 1, 0);
server->tcp_buffer_pos = 0;
/* Set the socket non-blocking. */
if (configure_socket(s, channel) < 0)
{
- close(s);
+ closesocket(s);
return -1;
}
sockin.sin_port = (unsigned short)(channel->udp_port & 0xffff);
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1)
{
- closesocket(s);
- return -1;
+ int err = SOCKERRNO;
+
+ if (err != EINPROGRESS && err != EWOULDBLOCK)
+ {
+ closesocket(s);
+ return -1;
+ }
}
SOCK_STATE_CALLBACK(channel, s, 1, 0);