From 3bbd1dc727da2e4346761b41eeb624af81f0a5cd Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Mon, 14 Oct 2019 20:25:56 +0800 Subject: [PATCH] modify make connection in test --- test/Makefile | 4 ++-- test/dfs_func.c | 6 +++--- test/test_delete.c | 6 ++---- test/test_download.c | 8 +++----- test/test_upload.c | 6 ++---- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/test/Makefile b/test/Makefile index fc7c367..c022e5e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,8 +5,8 @@ INC_PATH = -I/usr/local/include LIB_PATH = -L/usr/local/lib -lfdfsclient -lfastcommon TARGET_PATH = $(TARGET_PREFIX)/bin -#SHARED_OBJS = common_func.o dfs_func.o -SHARED_OBJS = common_func.o dfs_func_pc.o +SHARED_OBJS = common_func.o dfs_func.o +#SHARED_OBJS = common_func.o dfs_func_pc.o ALL_OBJS = $(SHARED_OBJS) diff --git a/test/dfs_func.c b/test/dfs_func.c index 53f03f9..1160bb9 100644 --- a/test/dfs_func.c +++ b/test/dfs_func.c @@ -49,7 +49,7 @@ int upload_file(const char *file_buff, const int file_size, char *file_id, char return result; } - if ((pStorageServer=tracker_connect_server(&storageServer, &result)) \ + if ((pStorageServer=tracker_make_connection(&storageServer, &result)) \ == NULL) { tracker_close_connection(pTrackerServer); @@ -87,7 +87,7 @@ int download_file(const char *file_id, int *file_size, char *storage_ip) return result; } - if ((pStorageServer=tracker_connect_server(&storageServer, &result)) \ + if ((pStorageServer=tracker_make_connection(&storageServer, &result)) \ == NULL) { tracker_close_connection(pTrackerServer); @@ -125,7 +125,7 @@ int delete_file(const char *file_id, char *storage_ip) return result; } - if ((pStorageServer=tracker_connect_server(&storageServer, &result)) \ + if ((pStorageServer=tracker_make_connection(&storageServer, &result)) \ == NULL) { tracker_close_connection(pTrackerServer); diff --git a/test/test_delete.c b/test/test_delete.c index c933b2a..f08d120 100644 --- a/test/test_delete.c +++ b/test/test_delete.c @@ -7,6 +7,7 @@ #include #include #include +#include "fastcommon/shared_func.h" #include "fastcommon/logger.h" #include "test_types.h" #include "common_func.h" @@ -119,10 +120,7 @@ int main(int argc, char **argv) } #ifndef WIN32 - if (daemon(1, 1) != 0) - { - return errno != 0 ? errno : EFAULT; - } + daemon_init(false); #endif /* diff --git a/test/test_download.c b/test/test_download.c index 87f1b98..da3a042 100644 --- a/test/test_download.c +++ b/test/test_download.c @@ -7,8 +7,9 @@ #include #include #include -#include "fastcommon/logger.h" #include "fastcommon/common_define.h" +#include "fastcommon/shared_func.h" +#include "fastcommon/logger.h" #include "test_types.h" #include "common_func.h" #include "dfs_func.h" @@ -127,10 +128,7 @@ int main(int argc, char **argv) } #ifndef WIN32 - if (daemon(1, 1) != 0) - { - return errno != 0 ? errno : EFAULT; - } + daemon_init(false); #endif /* diff --git a/test/test_upload.c b/test/test_upload.c index 2f2a190..a54f6c3 100644 --- a/test/test_upload.c +++ b/test/test_upload.c @@ -9,6 +9,7 @@ #include #include #include "fastcommon/common_define.h" +#include "fastcommon/shared_func.h" #include "fastcommon/logger.h" #include "test_types.h" #include "common_func.h" @@ -121,10 +122,7 @@ int main(int argc, char **argv) } #ifndef WIN32 - if (daemon(1, 1) != 0) - { - return errno != 0 ? errno : EFAULT; - } + daemon_init(false); #endif memset(&storages, 0, sizeof(storages));