From 02ba913dc7bb5d711471b27f2ea23a897d0f2e28 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 23 四月 2021 15:34:26 +0800 Subject: [PATCH] bind msgi to shm, change offset_ptr to abs offset. --- src/socket.cpp | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/socket.cpp b/src/socket.cpp index 1315474..313c212 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -24,11 +24,6 @@ using namespace bhome_msg; using namespace bhome_shm; -namespace -{ - -} // namespace - ShmSocket::ShmSocket(Shm &shm, const MQId &id, const int len) : run_(false), mq_(id, shm, len) { @@ -42,7 +37,7 @@ ShmSocket::~ShmSocket() { - Stop(); //TODO should stop in sub class, incase thread access sub class data. + Stop(); } bool ShmSocket::Start(int nworker, const RecvCB &onData, const IdleCB &onIdle) @@ -64,7 +59,7 @@ return false; } auto onMsg = [&](MsgI &imsg) { - DEFER1(imsg.Release(shm())); + DEFER1(imsg.Release()); BHMsgHead head; if (imsg.ParseHead(head)) { onRecvWithPerMsgCB(*this, imsg, head); @@ -123,7 +118,7 @@ if (msg.ParseHead(head)) { return true; } else { - msg.Release(shm()); + msg.Release(); } } return false; -- Gitblit v1.8.0