Refine addr resolving

This commit is contained in:
Max Lv
2016-12-20 22:17:04 +08:00
parent 6be61ccaea
commit 134a35fd6c
2 changed files with 3 additions and 11 deletions
+1 -1
View File
@@ -238,7 +238,7 @@ read_jconf(const char *file)
conf.mptcp = value->u.boolean;
} else if (strcmp(name, "ipv6_first") == 0) {
check_json_value_type(value, json_boolean,
"invalid config file: option 'mptcp' must be a boolean");
"invalid config file: option 'ipv6_first' must be a boolean");
conf.ipv6_first = value->u.boolean;
}
}
+2 -10
View File
@@ -632,13 +632,8 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
LOGI("bypass [%s]:%s", ip, port);
}
struct sockaddr_storage storage;
int err;
memset(&storage, 0, sizeof(struct sockaddr_storage));
if (atyp == 1 || atyp == 4) {
err = get_sockaddr(ip, port, &storage, 0, ipv6first);
} else {
err = get_sockaddr(host, port, &storage, 1, ipv6first);
}
int err = get_sockaddr(ip, port, &storage, 0, ipv6first);
if (err != -1) {
remote = create_remote(server->listener, (struct sockaddr *)&storage);
if (remote != NULL) remote->direct = 1;
@@ -1458,9 +1453,6 @@ main(int argc, char **argv)
}
#endif
// Disable retry
keep_resolving = 0;
// Init connections
cork_dllist_init(&connections);
@@ -1562,7 +1554,7 @@ start_ss_local_server(profile_t profile)
struct sockaddr_storage *storage = ss_malloc(sizeof(struct sockaddr_storage));
memset(storage, 0, sizeof(struct sockaddr_storage));
if (get_sockaddr(remote_host, remote_port_str, storage, 1, ipv6first) == -1) {
if (get_sockaddr(remote_host, remote_port_str, storage, 0, ipv6first) == -1) {
return -1;
}