From 62107801c171f26c69d0f72da8982c5fab5ce3a4 Mon Sep 17 00:00:00 2001 From: zhengshuxin Date: Mon, 20 Mar 2023 17:01:23 +0800 Subject: [PATCH] optimize codes. --- lib_acl/src/stdlib/iostuff/acl_read_wait.c | 2 ++ lib_acl_cpp/src/http/websocket.cpp | 4 ++-- lib_acl_cpp/src/redis/redis_command.cpp | 4 +++- lib_acl_cpp/src/stdlib/json.cpp | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib_acl/src/stdlib/iostuff/acl_read_wait.c b/lib_acl/src/stdlib/iostuff/acl_read_wait.c index 9b0e66a5d..dc168e45f 100644 --- a/lib_acl/src/stdlib/iostuff/acl_read_wait.c +++ b/lib_acl/src/stdlib/iostuff/acl_read_wait.c @@ -339,9 +339,11 @@ int acl_read_poll_wait(ACL_SOCKET fd, int delay) if (acl_last_error() == ACL_EINTR) { break; } + /* acl_msg_error("%s(%d), %s: poll error(%s), fd: %d", __FILE__, __LINE__, myname, acl_last_serror(), (int) fd); + */ return -1; case 0: /* diff --git a/lib_acl_cpp/src/http/websocket.cpp b/lib_acl_cpp/src/http/websocket.cpp index c533933da..fd532d5ea 100644 --- a/lib_acl_cpp/src/http/websocket.cpp +++ b/lib_acl_cpp/src/http/websocket.cpp @@ -409,8 +409,8 @@ bool websocket::read_frame_head(void) if (client_.read(buf, 2) == -1) { if (last_error() != ACL_ETIMEDOUT) { - logger_error("read first two char error: %d, %s", - last_error(), last_serror()); + //logger_error("read first two char error: %d, %s", + // last_error(), last_serror()); } return false; } diff --git a/lib_acl_cpp/src/redis/redis_command.cpp b/lib_acl_cpp/src/redis/redis_command.cpp index b1818d00c..d5ffea731 100644 --- a/lib_acl_cpp/src/redis/redis_command.cpp +++ b/lib_acl_cpp/src/redis/redis_command.cpp @@ -39,7 +39,9 @@ void redis_command::init(void) result_ = NULL; pipe_msg_ = NULL; addr_[0] = 0; - dbuf_ = new dbuf_pool(); + +#define REDIS_DBUF_NBLOCK 1 + dbuf_ = new (REDIS_DBUF_NBLOCK) dbuf_pool(); } redis_command::redis_command(void) diff --git a/lib_acl_cpp/src/stdlib/json.cpp b/lib_acl_cpp/src/stdlib/json.cpp index 1149528b4..1bc886af5 100644 --- a/lib_acl_cpp/src/stdlib/json.cpp +++ b/lib_acl_cpp/src/stdlib/json.cpp @@ -448,7 +448,8 @@ json::json(const char* data /* NULL */, dbuf_guard* dbuf /* NULL */) if (dbuf) { dbuf_ = dbuf; } else { - dbuf_ = dbuf_internal_ = NEW dbuf_guard; +#define JSON_DBUF_NBLOCK 1 + dbuf_ = dbuf_internal_ = NEW dbuf_guard(JSON_DBUF_NBLOCK); } json_ = acl_json_dbuf_alloc(dbuf_->get_dbuf().get_dbuf());