|
|
@ -449,7 +449,7 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now) |
|
|
|
static int open_tcp_socket(ares_channel channel, struct server_state *server) |
|
|
|
static int open_tcp_socket(ares_channel channel, struct server_state *server) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int s, flags; |
|
|
|
int s, flags; |
|
|
|
struct sockaddr_in sin; |
|
|
|
struct sockaddr_in sockin; |
|
|
|
|
|
|
|
|
|
|
|
/* Acquire a socket. */ |
|
|
|
/* Acquire a socket. */ |
|
|
|
s = socket(AF_INET, SOCK_STREAM, 0); |
|
|
|
s = socket(AF_INET, SOCK_STREAM, 0); |
|
|
@ -478,11 +478,11 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/* Connect to the server. */ |
|
|
|
/* Connect to the server. */ |
|
|
|
memset(&sin, 0, sizeof(sin)); |
|
|
|
memset(&sockin, 0, sizeof(sockin)); |
|
|
|
sin.sin_family = AF_INET; |
|
|
|
sockin.sin_family = AF_INET; |
|
|
|
sin.sin_addr = server->addr; |
|
|
|
sockin.sin_addr = server->addr; |
|
|
|
sin.sin_port = channel->tcp_port; |
|
|
|
sockin.sin_port = channel->tcp_port; |
|
|
|
if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == -1 |
|
|
|
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1 |
|
|
|
&& errno != EINPROGRESS) |
|
|
|
&& errno != EINPROGRESS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
closesocket(s); |
|
|
|
closesocket(s); |
|
|
@ -496,7 +496,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) |
|
|
|
static int open_udp_socket(ares_channel channel, struct server_state *server) |
|
|
|
static int open_udp_socket(ares_channel channel, struct server_state *server) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int s; |
|
|
|
int s; |
|
|
|
struct sockaddr_in sin; |
|
|
|
struct sockaddr_in sockin; |
|
|
|
|
|
|
|
|
|
|
|
/* Acquire a socket. */ |
|
|
|
/* Acquire a socket. */ |
|
|
|
s = socket(AF_INET, SOCK_DGRAM, 0); |
|
|
|
s = socket(AF_INET, SOCK_DGRAM, 0); |
|
|
@ -504,11 +504,11 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
/* Connect to the server. */ |
|
|
|
/* Connect to the server. */ |
|
|
|
memset(&sin, 0, sizeof(sin)); |
|
|
|
memset(&sockin, 0, sizeof(sockin)); |
|
|
|
sin.sin_family = AF_INET; |
|
|
|
sockin.sin_family = AF_INET; |
|
|
|
sin.sin_addr = server->addr; |
|
|
|
sockin.sin_addr = server->addr; |
|
|
|
sin.sin_port = channel->udp_port; |
|
|
|
sockin.sin_port = channel->udp_port; |
|
|
|
if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) |
|
|
|
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
closesocket(s); |
|
|
|
closesocket(s); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|