mirror of
https://github.com/liudf0716/apfree_wifidog.git
synced 2025-01-08 11:57:37 +08:00
skip always dns resolve when ip already exist
This commit is contained in:
parent
13b5677154
commit
9706596099
@ -21,3 +21,5 @@ Thank you to all contributors:
|
||||
[wenchangshou2](https://github.com/wenchangshou2)
|
||||
|
||||
[Lzxiangxmut](https://github.com/Lzxiangxmut)
|
||||
|
||||
[fenggui321](https://github.com/fenggui321)
|
||||
|
9
src/centralserver.c
Normal file → Executable file
9
src/centralserver.c
Normal file → Executable file
@ -462,6 +462,7 @@ _connect_auth_server(int level) {
|
||||
*/
|
||||
auth_server = config->auth_servers;
|
||||
hostname = auth_server->authserv_hostname;
|
||||
if (NULL == auth_server->last_ip){
|
||||
debug(LOG_DEBUG, "Level %d: Resolving auth server [%s]", level, hostname);
|
||||
h_addr = wd_gethostbyname(hostname);
|
||||
if (!h_addr) {
|
||||
@ -504,7 +505,9 @@ _connect_auth_server(int level) {
|
||||
*/
|
||||
free(ip);
|
||||
}
|
||||
|
||||
free(h_addr);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Connect to it
|
||||
*/
|
||||
@ -513,9 +516,8 @@ _connect_auth_server(int level) {
|
||||
|
||||
their_addr.sin_port = port;
|
||||
their_addr.sin_family = AF_INET;
|
||||
their_addr.sin_addr = *h_addr;
|
||||
inet_aton(auth_server->last_ip, &their_addr.sin_addr);
|
||||
memset(&(their_addr.sin_zero), '\0', sizeof(their_addr.sin_zero));
|
||||
free(h_addr);
|
||||
|
||||
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
debug(LOG_ERR, "Level %d: Failed to create a new SOCK_STREAM socket: %s", strerror(errno));
|
||||
@ -538,7 +540,6 @@ _connect_auth_server(int level) {
|
||||
return _connect_auth_server(level); /* Yay recursion! */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0, failure; 1, success
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user