From 93b71a7989f678bf36f12333787a056559f29ccf Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期日, 25 四月 2021 10:21:39 +0800 Subject: [PATCH] remove failed msgq. --- /dev/null | 48 ------------------------------------------------ 1 files changed, 0 insertions(+), 48 deletions(-) diff --git a/src/failed_msg.cpp b/src/failed_msg.cpp deleted file mode 100644 index d8a3182..0000000 --- a/src/failed_msg.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: failed_msg.cpp - * - * Description: - * - * Version: 1.0 - * Created: 2021骞�04鏈�12鏃� 16鏃�10鍒�53绉� - * Revision: none - * Compiler: gcc - * - * Author: Li Chao (), lichao@aiotlink.com - * Organization: - * - * ===================================================================================== - */ -#include "failed_msg.h" - -FailedMsgQ::Func FailedMsgQ::PrepareSender(const std::string &remote, Msg msg) -{ - msg.AddRef(); - return [remote, msg](void *valid_sock) mutable { - assert(valid_sock); - ShmSocket &sock = *static_cast<ShmSocket *>(valid_sock); - DEFER1(msg.Release()); // Release() is not const, but it's safe to release. - return sock.Send(remote.data(), msg); - }; -} \ No newline at end of file diff --git a/src/failed_msg.h b/src/failed_msg.h deleted file mode 100644 index 8a810c7..0000000 --- a/src/failed_msg.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: failed_msg.h - * - * Description: - * - * Version: 1.0 - * Created: 2021骞�04鏈�12鏃� 11鏃�21鍒�30绉� - * Revision: none - * Compiler: gcc - * - * Author: Li Chao (), lichao@aiotlink.com - * Organization: - * - * ===================================================================================== - */ -#ifndef FAILED_MSG_9YOI86AS -#define FAILED_MSG_9YOI86AS - -#include "msg.h" -#include "socket.h" -#include "timed_queue.h" -#include <string> - -//TODO change storage to map<Remote,list<TimedData<Msg>>>, to avoid retry failed remotes messages. -class FailedMsgQ -{ - typedef std::function<bool(void *)> Func; - typedef TimedQueue<Func> TimedFuncQ; - -public: - typedef bhome_msg::MsgI Msg; - - void Push(const std::string &remote, Msg const &msg, TimedFuncQ::TimePoint const &exr) { queue_.Push(PrepareSender(remote, msg), exr); } - void Push(const std::string &remote, Msg const &msg, TimedFuncQ::Duration const &exr) { queue_.Push(PrepareSender(remote, msg), exr); } - void TrySend(ShmSocket &socket) - { - queue_.CheckAll([&](Func &f) { return f(&socket); }); - } - -private: - Func PrepareSender(const std::string &remote, Msg msg); - - TimedFuncQ queue_; -}; - -#endif // end of include guard: FAILED_MSG_9YOI86AS -- Gitblit v1.8.0