From 58d904a328c0d849769b483e901a0be9426b8209 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 20 七月 2021 20:20:44 +0800
Subject: [PATCH] 调整Request C.BHFree的位置

---
 box/tcp_proxy.h |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/box/tcp_proxy.h b/box/tcp_proxy.h
index 8f2af91..09febe5 100644
--- a/box/tcp_proxy.h
+++ b/box/tcp_proxy.h
@@ -18,28 +18,25 @@
 #ifndef TCP_PROXY_E1YJ92U5
 #define TCP_PROXY_E1YJ92U5
 
-#include "shm.h"
+#include "bh_util.h"
+#include "io_service.h"
 #include "tcp_common.h"
-#include <atomic>
-#include <thread>
+#include <memory>
 
-class ShmSocket;
+class NodeCenter;
+typedef std::shared_ptr<Synced<NodeCenter>> CenterPtr;
 
 class TcpProxy
 {
 public:
-	TcpProxy();
-	~TcpProxy();
-	bool Start(bhome_shm::SharedMemory &shm);
-	void Stop();
+	typedef IoService::io_service_t io_service_t;
+	TcpProxy(io_service_t &io) :
+	    io_(io) {}
+	bool Request(const std::string &ip, int port, std::string &&content, ReplyCB const &cb);
+	bool Publish(const std::string &ip, int port, std::string &&content);
 
 private:
-	bool Send(const std::string &ip, int port, std::string &&content);
-	std::unique_ptr<ShmSocket> local_;
-
-	boost::asio::io_context io_context_;
-	std::thread worker_;
-	std::atomic<bool> run_;
+	io_service_t &io_;
 };
 
 #endif // end of include guard: TCP_PROXY_E1YJ92U5

--
Gitblit v1.8.0