From c7f0d4923b5656e75234b09ca5fdafe2dee8073d Mon Sep 17 00:00:00 2001 From: Paul Hariel Date: Thu, 28 Sep 2023 17:40:26 +0200 Subject: [PATCH] Copy socket and remove shared_from_this --- shared/include/connection.h | 4 ++-- shared/src/Connection.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/include/connection.h b/shared/include/connection.h index f671672..6d450a0 100644 --- a/shared/include/connection.h +++ b/shared/include/connection.h @@ -14,11 +14,11 @@ namespace pine { /// @brief A connection base class that is used by the server and the client. - class connection : public std::enable_shared_from_this + class connection { public: /// @brief Construct a connection with the given socket. - connection(asio::ip::tcp::socket& socket); + connection(asio::ip::tcp::socket socket); /// @brief Destroy the connection. virtual ~connection(); diff --git a/shared/src/Connection.cpp b/shared/src/Connection.cpp index 4378a66..3d25976 100644 --- a/shared/src/Connection.cpp +++ b/shared/src/Connection.cpp @@ -12,7 +12,7 @@ namespace pine { - connection::connection(asio::ip::tcp::socket& socket) : + connection::connection(asio::ip::tcp::socket socket) : socket(std::move(socket)) { std::cout << "New connection: " << id << std::endl;