diff --git a/storage/storage_sync.c b/storage/storage_sync.c index 6aaf6e04555248b7e35cfc9465892f2caaf080d7..c73a7ef0ecbfcf119104c31e437e4dbc62e0149a 100644 --- a/storage/storage_sync.c +++ b/storage/storage_sync.c @@ -3040,13 +3040,18 @@ static void* storage_sync_thread_entrance(void* arg) __LINE__, pStorage->ip_addr, local_ip_addr); */ + /* if (strcmp(pStorage->id, g_my_server_id_str) == 0 || is_local_host_ip(pStorage->ip_addr)) + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ - "ip_addr %s belong to the local host," \ + "storage id: %s is myself," \ " sync thread exit.", \ - __LINE__, pStorage->ip_addr); + __LINE__, pStorage->id); fdfs_quit(&storage_server); close(storage_server.sock); break; @@ -3267,8 +3272,13 @@ int storage_sync_thread_start(const FDFSStorageBrief *pStorage) return 0; } + /* if (strcmp(pStorage->id, g_my_server_id_str) == 0 || is_local_host_ip(pStorage->ip_addr)) //can't self sync to self + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) //can't self sync to self { logWarning("file: "__FILE__", line: %d, " "storage id: %s is myself, can't start sync thread!", diff --git a/storage/trunk_mgr/trunk_sync.c b/storage/trunk_mgr/trunk_sync.c index 751d43cec6ae99c18a66cbd61386c76905e6fc36..324f23c5e5e49006f83d8333bd77b3fde8e9b288 100644 --- a/storage/trunk_mgr/trunk_sync.c +++ b/storage/trunk_mgr/trunk_sync.c @@ -2121,13 +2121,18 @@ static void *trunk_sync_thread_entrance(void* arg) __LINE__, pStorage->ip_addr, local_ip_addr); */ + /* if ((strcmp(pStorage->id, g_my_server_id_str) == 0) || is_local_host_ip(pStorage->ip_addr)) + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) { //can't self sync to self logError("file: "__FILE__", line: %d, " \ - "ip_addr %s belong to the local host," \ + "storage id: %s is myself," \ " trunk sync thread exit.", \ - __LINE__, pStorage->ip_addr); + __LINE__, pStorage->id); fdfs_quit(&storage_server); close(storage_server.sock); break; @@ -2378,8 +2383,13 @@ int trunk_sync_thread_start(const FDFSStorageBrief *pStorage) return 0; } + /* if ((strcmp(pStorage->id, g_my_server_id_str) == 0) || is_local_host_ip(pStorage->ip_addr)) //can't self sync to self + */ + + //modify: drop condition `is_local_host_ip(pStorage->ip_addr)` + if (strcmp(pStorage->id, g_my_server_id_str) == 0) //can't self sync to self { return 0; }