From 3b6c9dc5e8427a78deb6ddf479ff559cb54b92ec Mon Sep 17 00:00:00 2001 From: yuqing Date: Sat, 2 Aug 2014 11:03:02 +0800 Subject: [PATCH] network send and recv retry when error EINTR happen --- HISTORY | 3 +++ common/fdfs_global.c | 2 +- storage/storage_nio.c | 8 ++++++++ tracker/tracker_nio.c | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 832a549..62b3ea2 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,7 @@ +Version 5.03 2014-08-02 + * network send and recv retry when error EINTR happen + Version 5.02 2014-07-20 * corect README spell mistake * bug fixed: can't deal sync truncate file exception diff --git a/common/fdfs_global.c b/common/fdfs_global.c index c4d46d4..76d6441 100644 --- a/common/fdfs_global.c +++ b/common/fdfs_global.c @@ -23,7 +23,7 @@ int g_fdfs_connect_timeout = DEFAULT_CONNECT_TIMEOUT; int g_fdfs_network_timeout = DEFAULT_NETWORK_TIMEOUT; char g_fdfs_base_path[MAX_PATH_SIZE] = {'/', 't', 'm', 'p', '\0'}; -Version g_fdfs_version = {5, 2}; +Version g_fdfs_version = {5, 3}; bool g_use_connection_pool = false; ConnectionPool g_connection_pool; int g_connection_pool_max_idle_time = 3600; diff --git a/storage/storage_nio.c b/storage/storage_nio.c index 6213cb7..c2e0f3c 100644 --- a/storage/storage_nio.c +++ b/storage/storage_nio.c @@ -322,6 +322,10 @@ static void client_sock_read(int sock, short event, void *arg) if (errno == EAGAIN || errno == EWOULDBLOCK) { } + else if (errno == EINTR) + { + continue; + } else { logError("file: "__FILE__", line: %d, " \ @@ -456,6 +460,10 @@ static void client_sock_write(int sock, short event, void *arg) { set_send_event(pTask); } + else if (errno == EINTR) + { + continue; + } else { logError("file: "__FILE__", line: %d, " \ diff --git a/tracker/tracker_nio.c b/tracker/tracker_nio.c index 9d525f2..5072271 100644 --- a/tracker/tracker_nio.c +++ b/tracker/tracker_nio.c @@ -248,6 +248,10 @@ static void client_sock_read(int sock, short event, void *arg) if (errno == EAGAIN || errno == EWOULDBLOCK) { } + else if (errno == EINTR) + { + continue; + } else { logError("file: "__FILE__", line: %d, " \ @@ -361,6 +365,10 @@ static void client_sock_write(int sock, short event, void *arg) { set_send_event(pTask); } + else if (errno == EINTR) + { + continue; + } else { logError("file: "__FILE__", line: %d, " \