From 1b52f1cb8c47dd2c0195d2fd65d7b6a4c2f10704 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期一, 12 四月 2021 18:29:41 +0800 Subject: [PATCH] add fail-resend support. --- src/socket.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/socket.cpp b/src/socket.cpp index 116175d..2c55665 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -45,11 +45,12 @@ { auto onRecvWithPerMsgCB = [this, onData](ShmSocket &socket, MsgI &imsg, BHMsgHead &head) { RecvCB cb; - if (async_cbs_->Find(head.msg_id(), cb)) { + if (per_msg_cbs_->Find(head.msg_id(), cb)) { cb(socket, imsg, head); } else if (onData) { onData(socket, imsg, head); - } // else ignored, or dropped + } else { // else ignored, or dropped + } }; auto recvLoopBody = [this, onRecvWithPerMsgCB, onIdle]() { @@ -61,7 +62,8 @@ if (imsg.ParseHead(head)) { onRecvWithPerMsgCB(*this, imsg, head); } - } else if (onIdle) { + } + if (onIdle) { onIdle(*this); } } catch (...) { -- Gitblit v1.8.0