From 232227035c8d6a31eaaf193863cbadda949c08fd Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 20 七月 2021 20:19:26 +0800
Subject: [PATCH] fix memory leak
---
box/center.h | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/box/center.h b/box/center.h
index ab8b15f..8850db4 100644
--- a/box/center.h
+++ b/box/center.h
@@ -18,10 +18,14 @@
#ifndef CENTER_TM9OUQTG
#define CENTER_TM9OUQTG
-#include "socket.h"
+#include "shm_socket.h"
#include <functional>
#include <map>
#include <memory>
+class CenterTopicNode;
+class TcpServer;
+class TcpProxy;
+class IoService;
class BHCenter
{
@@ -29,11 +33,12 @@
public:
typedef Socket::PartialRecvCB MsgHandler;
+ typedef Socket::RawRecvCB RawHandler;
typedef Socket::IdleCB IdleHandler;
- static bool Install(const std::string &name, MsgHandler handler, IdleHandler idle, const MQId mqid, const int mq_len);
+ static bool Install(const std::string &name, MsgHandler handler, RawHandler raw_handler, IdleHandler idle, const MQInfo &mq, const int mq_len);
BHCenter(Socket::Shm &shm);
- ~BHCenter() { Stop(); }
+ ~BHCenter();
bool Start();
bool Stop();
@@ -41,14 +46,20 @@
struct CenterInfo {
std::string name_;
MsgHandler handler_;
+ RawHandler raw_handler_;
IdleHandler idle_;
- MQId mqid_;
+ MQInfo mq_;
int mq_len_ = 0;
};
typedef std::map<std::string, CenterInfo> CenterRecords;
static CenterRecords &Centers();
std::map<std::string, std::shared_ptr<ShmSocket>> sockets_;
+ std::unique_ptr<CenterTopicNode> topic_node_;
+
+ std::unique_ptr<IoService> io_service_;
+ std::unique_ptr<TcpServer> tcp_server_;
+ std::unique_ptr<TcpProxy> tcp_proxy_;
};
#endif // end of include guard: CENTER_TM9OUQTG
--
Gitblit v1.8.0