Unverified Commit 9b2a7a5b authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #412 from knowledge4igor/second_step_of_memory_leaks_fix_in_client

Second step of fixing memory leaks in Client
parents ded5e71e d114e661
...@@ -199,7 +199,7 @@ public: ...@@ -199,7 +199,7 @@ public:
asyncConnect(std::shared_ptr<Connection> connection, const struct sockaddr* address, socklen_t addr_len); asyncConnect(std::shared_ptr<Connection> connection, const struct sockaddr* address, socklen_t addr_len);
Async::Promise<ssize_t> asyncSendRequest( Async::Promise<ssize_t> asyncSendRequest(
const std::shared_ptr<Connection>& connection, std::shared_ptr<Connection> connection,
std::shared_ptr<TimerPool::Entry> timer, std::shared_ptr<TimerPool::Entry> timer,
std::string buffer); std::string buffer);
...@@ -236,7 +236,7 @@ private: ...@@ -236,7 +236,7 @@ private:
std::string buf) std::string buf)
: resolve(std::move(resolve)) : resolve(std::move(resolve))
, reject(std::move(reject)) , reject(std::move(reject))
, connection(std::move(connection)) , connection(connection)
, timer(std::move(timer)) , timer(std::move(timer))
, buffer(std::move(buf)) , buffer(std::move(buf))
{ {
...@@ -244,7 +244,7 @@ private: ...@@ -244,7 +244,7 @@ private:
Async::Resolver resolve; Async::Resolver resolve;
Async::Rejection reject; Async::Rejection reject;
std::shared_ptr<Connection> connection; std::weak_ptr<Connection> connection;
std::shared_ptr<TimerPool::Entry> timer; std::shared_ptr<TimerPool::Entry> timer;
std::string buffer; std::string buffer;
}; };
......
...@@ -202,7 +202,7 @@ Transport::asyncConnect(std::shared_ptr<Connection> connection, const struct soc ...@@ -202,7 +202,7 @@ Transport::asyncConnect(std::shared_ptr<Connection> connection, const struct soc
Async::Promise<ssize_t> Async::Promise<ssize_t>
Transport::asyncSendRequest( Transport::asyncSendRequest(
const std::shared_ptr<Connection>& connection, std::shared_ptr<Connection> connection,
std::shared_ptr<TimerPool::Entry> timer, std::shared_ptr<TimerPool::Entry> timer,
std::string buffer) { std::string buffer) {
...@@ -223,7 +223,9 @@ Transport::asyncSendRequestImpl( ...@@ -223,7 +223,9 @@ Transport::asyncSendRequestImpl(
const RequestEntry& req, WriteStatus status) const RequestEntry& req, WriteStatus status)
{ {
const auto& buffer = req.buffer; const auto& buffer = req.buffer;
auto conn = req.connection; auto conn = req.connection.lock();
if (!conn)
throw std::runtime_error("Send request error");
auto fd = conn->fd; auto fd = conn->fd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment