From 958c000729644fb889c6dd20da00cff73b1abdd3 Mon Sep 17 00:00:00 2001 From: Joris CARRIER Date: Fri, 27 Oct 2023 10:58:12 +0200 Subject: [PATCH] allow execution of `on_unknown_torrent` method in the absence of active torrents --- src/session_impl.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 1e1c34e6640..8ed3c2f75a4 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -17,6 +17,7 @@ Copyright (c) 2020, Fonic Copyright (c) 2020, Paul-Louis Ageneau Copyright (c) 2022, Vladimir Golovnev (glassez) Copyright (c) 2022, thrnz +Copyright (c) 2023, Joris Carrier All rights reserved. Redistribution and use in source and binary forms, with or without @@ -3084,16 +3085,6 @@ namespace { return; } - // check if we have any active torrents - // if we don't reject the connection - if (m_torrents.empty()) - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("<== INCOMING CONNECTION [ rejected, there are no torrents ]"); -#endif - return; - } - // figure out which peer classes this is connections has, // to get connection_limit_factor peer_class_set pcs; @@ -3135,25 +3126,6 @@ namespace { return; } - // if we don't have any active torrents, there's no - // point in accepting this connection. If, however, - // the setting to start up queued torrents when they - // get an incoming connection is enabled, we cannot - // perform this check. - if (!m_settings.get_bool(settings_pack::incoming_starts_queued_torrents)) - { - bool has_active_torrent = std::any_of(m_torrents.begin(), m_torrents.end() - , [](std::shared_ptr const& i) - { return !i->is_torrent_paused(); }); - if (!has_active_torrent) - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("<== INCOMING CONNECTION [ rejected, no active torrents ]"); -#endif - return; - } - } - m_stats_counters.inc_stats_counter(counters::incoming_connections); if (m_alerts.should_post())