From 2561a007b8d8999a4750046d0cfb3b1ad5af50ac Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期二, 09 四月 2024 15:29:32 +0800 Subject: [PATCH] test for perf --- src/net/net_mod_socket.cpp | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/net/net_mod_socket.cpp b/src/net/net_mod_socket.cpp index 2f5ce73..d10fbdc 100644 --- a/src/net/net_mod_socket.cpp +++ b/src/net/net_mod_socket.cpp @@ -46,10 +46,6 @@ return shmModSocket.force_bind(key); } -int NetModSocket::bind_proc_id(char *buf, int len) { - return shmModSocket.bind_proc_id(buf, len); -} - int NetModSocket::reg(void *pData, int len, void **buf, int *size, const int timeout_ms, int flag) { return shmModSocket.reg(pData, len, buf, size, timeout_ms, flag); @@ -125,7 +121,6 @@ if (mpool == NULL) { /* If first call from this thread, allocate buffer for thread, and save its location */ - logger->debug("Create connPool"); mpool = new NetConnPool(); if (mpool == NULL) { LoggerFactory::getLogger()->error(errno, "NetModSocket::_sendandrecv_ malloc"); @@ -345,6 +340,29 @@ } +void NetModSocket::buf_data_set(std::string str, int val) { + recvbuf.insert({str, val}); +} + +int NetModSocket::buf_data_get(std::string str) { + + int i; + int val = 0; + std::map<std::string, int>::iterator recvIter; + + recvIter = recvbuf.find(str); + if(recvIter != recvbuf.end()) { + + val = recvIter->second; + + } + + return val; +} + +void NetModSocket::buf_data_del(std::string str) { + recvbuf.erase(str); +} void NetModSocket::free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size) { -- Gitblit v1.8.0