minor cleanups in some extensions

This commit is contained in:
arvidn 2018-01-18 16:23:22 +01:00 committed by Arvid Norberg
parent 785fffd976
commit ed7ef8fdd6
2 changed files with 4 additions and 6 deletions

View File

@ -482,8 +482,7 @@ namespace libtorrent {namespace {
std::shared_ptr<peer_plugin> ut_metadata_plugin::new_connection(
peer_connection_handle const& pc)
{
if (pc.type() != connection_type::bittorrent)
return std::shared_ptr<peer_plugin>();
if (pc.type() != connection_type::bittorrent) return {};
bt_peer_connection* c = static_cast<bt_peer_connection*>(pc.native_handle().get());
return std::make_shared<ut_metadata_peer_plugin>(m_torrent, *c, *this);
@ -636,7 +635,7 @@ namespace libtorrent {
{
torrent* t = th.native_handle().get();
// don't add this extension if the torrent is private
if (t->valid_metadata() && t->torrent_file().priv()) return std::shared_ptr<torrent_plugin>();
if (t->valid_metadata() && t->torrent_file().priv()) return {};
return std::make_shared<ut_metadata_plugin>(*t);
}
}

View File

@ -631,8 +631,7 @@ namespace libtorrent {namespace {
std::shared_ptr<peer_plugin> ut_pex_plugin::new_connection(peer_connection_handle const& pc)
{
if (pc.type() != connection_type::bittorrent)
return std::shared_ptr<peer_plugin>();
if (pc.type() != connection_type::bittorrent) return {};
bt_peer_connection* c = static_cast<bt_peer_connection*>(pc.native_handle().get());
auto p = std::make_shared<ut_pex_peer_plugin>(m_torrent, *c, *this);
@ -649,7 +648,7 @@ namespace libtorrent {
if (t->torrent_file().priv() || (t->torrent_file().is_i2p()
&& !t->settings().get_bool(settings_pack::allow_i2p_mixed)))
{
return std::shared_ptr<torrent_plugin>();
return {};
}
return std::make_shared<ut_pex_plugin>(*t);
}