1
0
Fork 0

Codechange: Remove empty destructor and use member init for ClientNetworkContentSocketHandler.

pull/13990/head
Peter Nelson 2025-04-11 21:19:42 +01:00 committed by Peter Nelson
parent 20d83677eb
commit 3347919fb2
2 changed files with 8 additions and 30 deletions

View File

@ -707,25 +707,6 @@ void ClientNetworkContentSocketHandler::OnReceiveData(std::unique_ptr<char[]> da
#undef check_and_terminate
}
/**
* Create a socket handler to handle the connection.
*/
ClientNetworkContentSocketHandler::ClientNetworkContentSocketHandler() :
NetworkContentSocketHandler(),
http_response_index(-2),
cur_file(std::nullopt),
cur_info(nullptr),
is_connecting(false),
is_cancelled(false)
{
this->last_activity = std::chrono::steady_clock::now();
}
/** Clear up the mess ;) */
ClientNetworkContentSocketHandler::~ClientNetworkContentSocketHandler()
{
}
/** Connect to the content server. */
class NetworkContentConnecter : public TCPConnecter {
public:

View File

@ -63,18 +63,18 @@ struct ContentCallback {
class ClientNetworkContentSocketHandler : public NetworkContentSocketHandler, ContentCallback, HTTPCallback {
protected:
using ContentIDList = std::vector<ContentID>; ///< List of content IDs to (possibly) select.
std::vector<ContentCallback *> callbacks; ///< Callbacks to notify "the world"
ContentIDList requested; ///< ContentIDs we already requested (so we don't do it again)
ContentVector infos; ///< All content info we received
std::vector<ContentCallback *> callbacks; ///< Callbacks to notify "the world"
ContentIDList requested; ///< ContentIDs we already requested (so we don't do it again)
ContentVector infos; ///< All content info we received
std::unordered_multimap<ContentID, ContentID> reverse_dependency_map; ///< Content reverse dependency map
std::vector<char> http_response; ///< The HTTP response to the requests we've been doing
int http_response_index; ///< Where we are, in the response, with handling it
std::vector<char> http_response; ///< The HTTP response to the requests we've been doing
int http_response_index = -2; ///< Where we are, in the response, with handling it
std::optional<FileHandle> cur_file; ///< Currently downloaded file
std::unique_ptr<ContentInfo> cur_info; ///< Information about the currently downloaded file
bool is_connecting; ///< Whether we're connecting
bool is_cancelled; ///< Whether the download has been cancelled
std::chrono::steady_clock::time_point last_activity; ///< The last time there was network activity
bool is_connecting = false; ///< Whether we're connecting
bool is_cancelled = false; ///< Whether the download has been cancelled
std::chrono::steady_clock::time_point last_activity = std::chrono::steady_clock::now(); ///< The last time there was network activity
friend class NetworkContentConnecter;
@ -103,9 +103,6 @@ public:
/** The idle timeout; when to close the connection because it's idle. */
static constexpr std::chrono::seconds IDLE_TIMEOUT = std::chrono::seconds(60);
ClientNetworkContentSocketHandler();
~ClientNetworkContentSocketHandler();
void Connect();
void SendReceive();
NetworkRecvStatus CloseConnection(bool error = true) override;