From c2c072b9eca586908ca6bfe2e73730e23315447b Mon Sep 17 00:00:00 2001 From: antao Date: Mon, 20 Aug 2018 17:05:59 +0800 Subject: [PATCH] Add debug output --- lib/src/HttpClientImpl.cc | 4 ++++ lib/src/HttpClientImpl.h | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/src/HttpClientImpl.cc b/lib/src/HttpClientImpl.cc index 6ec4c6f0..5cc6b49f 100644 --- a/lib/src/HttpClientImpl.cc +++ b/lib/src/HttpClientImpl.cc @@ -12,6 +12,10 @@ HttpClientImpl::HttpClientImpl(trantor::EventLoop *loop, _useSSL(useSSL) { +} +HttpClientImpl::~HttpClientImpl() +{ + LOG_TRACE<<"Deconstruction HttpClient"; } void HttpClientImpl::sendRequest(const drogon::HttpRequestPtr &req, const drogon::HttpReqCallback &callback) { diff --git a/lib/src/HttpClientImpl.h b/lib/src/HttpClientImpl.h index 38d2cd80..cf4a9f08 100644 --- a/lib/src/HttpClientImpl.h +++ b/lib/src/HttpClientImpl.h @@ -21,17 +21,18 @@ namespace drogon{ class HttpClientImpl:public HttpClient,public std::enable_shared_from_this { - public: - HttpClientImpl(trantor::EventLoop *loop,const trantor::InetAddress &addr,bool useSSL=false); - virtual void sendRequest(const HttpRequestPtr &req,const HttpReqCallback &callback) override; - private: - std::shared_ptr _tcpClient; - trantor::EventLoop *_loop; - trantor::InetAddress _server; - bool _useSSL; - void sendReq(const trantor::TcpConnectionPtr &connectorPtr,const HttpRequestPtr &req); - void sendRequestInLoop(const HttpRequestPtr &req,const HttpReqCallback &callback); - std::queue> _reqAndCallbacks; - void onRecvMessage(const trantor::TcpConnectionPtr&,trantor::MsgBuffer*); - }; +public: + HttpClientImpl(trantor::EventLoop *loop,const trantor::InetAddress &addr,bool useSSL=false); + virtual void sendRequest(const HttpRequestPtr &req,const HttpReqCallback &callback) override; + ~HttpClientImpl(); +private: + std::shared_ptr _tcpClient; + trantor::EventLoop *_loop; + trantor::InetAddress _server; + bool _useSSL; + void sendReq(const trantor::TcpConnectionPtr &connectorPtr,const HttpRequestPtr &req); + void sendRequestInLoop(const HttpRequestPtr &req,const HttpReqCallback &callback); + std::queue> _reqAndCallbacks; + void onRecvMessage(const trantor::TcpConnectionPtr&,trantor::MsgBuffer*); +}; } \ No newline at end of file