From dc86ace85e437ecb8a2e728e4dce36d02bbb8a6e Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 23 四月 2021 12:59:50 +0800 Subject: [PATCH] move ref count into msg meta, only 1 poinetr now. --- src/sendq.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sendq.cpp b/src/sendq.cpp index 4be24f1..8aa7214 100644 --- a/src/sendq.cpp +++ b/src/sendq.cpp @@ -42,17 +42,15 @@ if (d.index() == 0) { auto &msg = boost::variant2::get<0>(pos->data().data_); r = mq.TrySend(*(MQId *) remote.data(), msg); - if (r && msg.IsCounted()) { + if (r) { msg.Release(mq.shm()); } } else { auto &content = boost::variant2::get<1>(pos->data().data_); MsgI msg; if (msg.Make(mq.shm(), content)) { + DEFER1(msg.Release(mq.shm());); r = mq.TrySend(*(MQId *) remote.data(), msg); - if (!r || msg.IsCounted()) { - msg.Release(mq.shm()); - } } } return r; -- Gitblit v1.8.0