parameter use_storage_id in tracker.conf MUST set to true and
id_type_in_filename MUST set to id when IPv6 enabledpull/687/head
parent
7cae2bfb2b
commit
bd79b4d35b
|
|
@ -12,11 +12,13 @@ group_name = group1
|
||||||
|
|
||||||
# bind an address of this host
|
# bind an address of this host
|
||||||
# empty for bind all addresses of this host
|
# empty for bind all addresses of this host
|
||||||
# IPv4:
|
|
||||||
# for example: 192.168.2.100
|
|
||||||
#
|
#
|
||||||
# IPv6:
|
# bind IPv4 example: 192.168.2.100
|
||||||
# or example: [2409:8a20:42d:2f40:587a:4c47:72c0:ad8e]
|
#
|
||||||
|
# bind IPv6 example: 2409:8a20:42d:2f40:587a:4c47:72c0:ad8e
|
||||||
|
#
|
||||||
|
# bind IPv4 and IPv6 example: 192.168.2.100,2409:8a20:42d:2f40:587a:4c47:72c0:ad8e
|
||||||
|
#
|
||||||
bind_addr =
|
bind_addr =
|
||||||
|
|
||||||
# if bind an address of this host when connect to other servers
|
# if bind an address of this host when connect to other servers
|
||||||
|
|
@ -31,7 +33,7 @@ port = 23000
|
||||||
# the address family of service, value list:
|
# the address family of service, value list:
|
||||||
## IPv4: IPv4 stack
|
## IPv4: IPv4 stack
|
||||||
## IPv6: IPv6 stack
|
## IPv6: IPv6 stack
|
||||||
## auto: auto detect, IPv4 first, then IPv6
|
## auto: auto detect by bind_addr, IPv4 first then IPv6 when bind_addr is empty
|
||||||
## both: IPv4 and IPv6 dual stacks
|
## both: IPv4 and IPv6 dual stacks
|
||||||
# default value is auto
|
# default value is auto
|
||||||
address_family = auto
|
address_family = auto
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,13 @@ disabled = false
|
||||||
|
|
||||||
# bind an address of this host
|
# bind an address of this host
|
||||||
# empty for bind all addresses of this host
|
# empty for bind all addresses of this host
|
||||||
# IPv4:
|
|
||||||
# for example: 192.168.2.100
|
|
||||||
#
|
#
|
||||||
# IPv6:
|
# bind IPv4 example: 192.168.2.100
|
||||||
# or example: [2409:8a20:42d:2f40:587a:4c47:72c0:ad8e]
|
#
|
||||||
|
# bind IPv6 example: 2409:8a20:42d:2f40:587a:4c47:72c0:ad8e
|
||||||
|
#
|
||||||
|
# bind IPv4 and IPv6 example: 192.168.2.100,2409:8a20:42d:2f40:587a:4c47:72c0:ad8e
|
||||||
|
#
|
||||||
bind_addr =
|
bind_addr =
|
||||||
|
|
||||||
# the tracker server port
|
# the tracker server port
|
||||||
|
|
@ -18,8 +20,12 @@ port = 22122
|
||||||
# the address family of service, value list:
|
# the address family of service, value list:
|
||||||
## IPv4: IPv4 stack
|
## IPv4: IPv4 stack
|
||||||
## IPv6: IPv6 stack
|
## IPv6: IPv6 stack
|
||||||
## auto: auto detect, IPv4 first, then IPv6
|
## auto: auto detect by bind_addr, IPv4 first then IPv6 when bind_addr is empty
|
||||||
## both: IPv4 and IPv6 dual stacks
|
## both: IPv4 and IPv6 dual stacks
|
||||||
|
#
|
||||||
|
# following parameter use_storage_id MUST set to true and
|
||||||
|
# id_type_in_filename MUST set to id when IPv6 enabled
|
||||||
|
#
|
||||||
# default value is auto
|
# default value is auto
|
||||||
address_family = auto
|
address_family = auto
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,6 @@ static void *tracker_report_thread_entrance(void *arg)
|
||||||
|
|
||||||
tcpsetserveropt(conn->sock, SF_G_NETWORK_TIMEOUT);
|
tcpsetserveropt(conn->sock, SF_G_NETWORK_TIMEOUT);
|
||||||
getSockIpaddr(conn->sock, tracker_client_ip, IP_ADDRESS_SIZE);
|
getSockIpaddr(conn->sock, tracker_client_ip, IP_ADDRESS_SIZE);
|
||||||
|
|
||||||
if (nContinuousFail == 0)
|
if (nContinuousFail == 0)
|
||||||
{
|
{
|
||||||
*szFailPrompt = '\0';
|
*szFailPrompt = '\0';
|
||||||
|
|
|
||||||
|
|
@ -490,8 +490,8 @@ int fdfs_parse_server_info_ex(char *server_str, const int default_port,
|
||||||
{
|
{
|
||||||
if (resolve)
|
if (resolve)
|
||||||
{
|
{
|
||||||
if (getIpaddrByName(hosts[i], conn->ip_addr,
|
if (getIpaddrByNameEx(hosts[i], conn->ip_addr,
|
||||||
sizeof(conn->ip_addr)) == INADDR_NONE)
|
sizeof(conn->ip_addr), &conn->af) == INADDR_NONE)
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, "
|
logError("file: "__FILE__", line: %d, "
|
||||||
"host \"%s\" is invalid, error info: %s",
|
"host \"%s\" is invalid, error info: %s",
|
||||||
|
|
@ -503,6 +503,7 @@ int fdfs_parse_server_info_ex(char *server_str, const int default_port,
|
||||||
{
|
{
|
||||||
snprintf(conn->ip_addr, sizeof(conn->ip_addr), "%s", hosts[i]);
|
snprintf(conn->ip_addr, sizeof(conn->ip_addr), "%s", hosts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->port = port;
|
conn->port = port;
|
||||||
conn->sock = -1;
|
conn->sock = -1;
|
||||||
conn++;
|
conn++;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ static int tracker_load_store_lookup(const char *filename, \
|
||||||
if (fdfs_validate_group_name(g_groups.store_group) != 0) \
|
if (fdfs_validate_group_name(g_groups.store_group) != 0) \
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, " \
|
logError("file: "__FILE__", line: %d, " \
|
||||||
"conf file \"%s\", " \
|
"config file \"%s\", " \
|
||||||
"the group name \"%s\" is invalid!", \
|
"the group name \"%s\" is invalid!", \
|
||||||
__LINE__, filename, g_groups.store_group);
|
__LINE__, filename, g_groups.store_group);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
@ -98,7 +98,7 @@ static int tracker_load_store_lookup(const char *filename, \
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tracker_load_storage_id_info(const char *config_filename, \
|
static int tracker_load_storage_id_info(const char *config_filename,
|
||||||
IniContext *pItemContext)
|
IniContext *pItemContext)
|
||||||
{
|
{
|
||||||
char *pIdType;
|
char *pIdType;
|
||||||
|
|
@ -107,19 +107,33 @@ static int tracker_load_storage_id_info(const char *config_filename, \
|
||||||
pItemContext, false);
|
pItemContext, false);
|
||||||
if (!g_use_storage_id)
|
if (!g_use_storage_id)
|
||||||
{
|
{
|
||||||
|
if (SF_G_IPV6_ENABLED)
|
||||||
|
{
|
||||||
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
"config file: %s, use_storage_id MUST set to true "
|
||||||
|
"when IPv6 enabled!", __LINE__, config_filename);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pIdType = iniGetStrValue(NULL, "id_type_in_filename", \
|
pIdType = iniGetStrValue(NULL, "id_type_in_filename", pItemContext);
|
||||||
pItemContext);
|
|
||||||
if (pIdType != NULL && strcasecmp(pIdType, "id") == 0)
|
if (pIdType != NULL && strcasecmp(pIdType, "id") == 0)
|
||||||
{
|
{
|
||||||
g_id_type_in_filename = FDFS_ID_TYPE_SERVER_ID;
|
g_id_type_in_filename = FDFS_ID_TYPE_SERVER_ID;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_id_type_in_filename = FDFS_ID_TYPE_IP_ADDRESS;
|
if (SF_G_IPV6_ENABLED)
|
||||||
}
|
{
|
||||||
|
logError("file: "__FILE__", line: %d, "
|
||||||
|
"config file: %s, id_type_in_filename MUST set to id "
|
||||||
|
"when IPv6 enabled!", __LINE__, config_filename);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
g_id_type_in_filename = FDFS_ID_TYPE_IP_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
return fdfs_load_storage_ids_from_file(config_filename, pItemContext);
|
return fdfs_load_storage_ids_from_file(config_filename, pItemContext);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3459,7 +3459,7 @@ int tracker_mem_delete_storage(FDFSGroupInfo *pGroup, const char *id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tracker_mem_storage_ip_changed(FDFSGroupInfo *pGroup, \
|
int tracker_mem_storage_ip_changed(FDFSGroupInfo *pGroup,
|
||||||
const char *old_storage_ip, const char *new_storage_ip)
|
const char *old_storage_ip, const char *new_storage_ip)
|
||||||
{
|
{
|
||||||
FDFSStorageDetail *pOldStorageServer;
|
FDFSStorageDetail *pOldStorageServer;
|
||||||
|
|
|
||||||
|
|
@ -59,16 +59,16 @@ FDFSStorageDetail *tracker_mem_get_storage(FDFSGroupInfo *pGroup, \
|
||||||
FDFSStorageDetail *tracker_mem_get_storage_by_ip(FDFSGroupInfo *pGroup, \
|
FDFSStorageDetail *tracker_mem_get_storage_by_ip(FDFSGroupInfo *pGroup, \
|
||||||
const char *ip_addr);
|
const char *ip_addr);
|
||||||
|
|
||||||
const FDFSStorageDetail *tracker_mem_set_trunk_server( \
|
const FDFSStorageDetail *tracker_mem_set_trunk_server(
|
||||||
FDFSGroupInfo *pGroup, const char *pStroageId, int *result);
|
FDFSGroupInfo *pGroup, const char *pStroageId, int *result);
|
||||||
int tracker_mem_delete_group(const char *group_name);
|
int tracker_mem_delete_group(const char *group_name);
|
||||||
int tracker_mem_delete_storage(FDFSGroupInfo *pGroup, const char *id);
|
int tracker_mem_delete_storage(FDFSGroupInfo *pGroup, const char *id);
|
||||||
|
|
||||||
int tracker_mem_storage_ip_changed(FDFSGroupInfo *pGroup, \
|
int tracker_mem_storage_ip_changed(FDFSGroupInfo *pGroup,
|
||||||
const char *old_storage_ip, const char *new_storage_ip);
|
const char *old_storage_ip, const char *new_storage_ip);
|
||||||
|
|
||||||
int tracker_mem_add_group_and_storage(TrackerClientInfo *pClientInfo, \
|
int tracker_mem_add_group_and_storage(TrackerClientInfo *pClientInfo,
|
||||||
const char *ip_addr, FDFSStorageJoinBody *pJoinBody, \
|
const char *ip_addr, FDFSStorageJoinBody *pJoinBody,
|
||||||
const bool bNeedSleep);
|
const bool bNeedSleep);
|
||||||
|
|
||||||
int tracker_mem_offline_store_server(FDFSGroupInfo *pGroup, \
|
int tracker_mem_offline_store_server(FDFSGroupInfo *pGroup, \
|
||||||
|
|
|
||||||
|
|
@ -902,10 +902,13 @@ static int tracker_deal_get_storage_id(struct fast_task_info *pTask)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 当IP地址为IPv6时,其storage_id值为IP地址的short code
|
// 当IP地址为IPv6时,其storage_id值为IP地址的short code
|
||||||
if (is_ipv6_addr(ip_addr)) {
|
if (is_ipv6_addr(ip_addr))
|
||||||
|
{
|
||||||
storage_id.ptr = fdfs_ip_to_shortcode(ip_addr,
|
storage_id.ptr = fdfs_ip_to_shortcode(ip_addr,
|
||||||
storage_id.holder);
|
storage_id.holder);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
storage_id.ptr = ip_addr;
|
storage_id.ptr = ip_addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2005,7 +2008,7 @@ static int tracker_deal_storage_report_ip_changed(struct fast_task_info *pTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
pTask->send.ptr->length = sizeof(TrackerHeader);
|
pTask->send.ptr->length = sizeof(TrackerHeader);
|
||||||
return tracker_mem_storage_ip_changed(pGroup, \
|
return tracker_mem_storage_ip_changed(pGroup,
|
||||||
pOldIpAddr, pNewIpAddr);
|
pOldIpAddr, pNewIpAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue