fix: opt trans debug info
This commit is contained in:
parent
0d5aad85f8
commit
f6ca06ef2b
|
@ -223,9 +223,13 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// snprintf may cause performance problem
|
// snprintf may cause performance problem
|
||||||
#define CONN_CONSTRUCT_HASH_KEY(key, ip, port) \
|
#define CONN_CONSTRUCT_HASH_KEY(key, ip, port) \
|
||||||
do { \
|
do { \
|
||||||
snprintf(key, sizeof(key), "%s:%d", ip, (int)port); \
|
char* p = key; \
|
||||||
|
int32_t len = strlen(ip); \
|
||||||
|
if (p != NULL) memcpy(p, ip, len); \
|
||||||
|
p[len] = ':'; \
|
||||||
|
titoa(port, 10, &p[len + 1]); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
|
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
|
||||||
|
@ -663,7 +667,7 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
|
||||||
static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
|
static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
|
||||||
SCliConn* conn = handle->data;
|
SCliConn* conn = handle->data;
|
||||||
SConnBuffer* pBuf = &conn->readBuf;
|
SConnBuffer* pBuf = &conn->readBuf;
|
||||||
tDebug("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn);
|
tTrace("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn);
|
||||||
transAllocBuffer(pBuf, buf);
|
transAllocBuffer(pBuf, buf);
|
||||||
}
|
}
|
||||||
static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
||||||
|
@ -676,7 +680,7 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
||||||
if (nread > 0) {
|
if (nread > 0) {
|
||||||
pBuf->len += nread;
|
pBuf->len += nread;
|
||||||
while (transReadComplete(pBuf)) {
|
while (transReadComplete(pBuf)) {
|
||||||
tDebug("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn);
|
tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn);
|
||||||
if (pBuf->invalid) {
|
if (pBuf->invalid) {
|
||||||
cliHandleExcept(conn);
|
cliHandleExcept(conn);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue