removed repeated code and minor code refactor

This commit is contained in:
Alden Torres 2018-12-04 19:31:33 -05:00 committed by Arvid Norberg
parent 1efe05c96e
commit 3e582100d0
4 changed files with 5 additions and 11 deletions

View File

@ -84,7 +84,7 @@ public:
executor_type get_executor() { return m_sock.get_executor(); }
#endif
void set_host_name(std::string name)
void set_host_name(std::string const& name)
{
aux::openssl_set_tlsext_hostname(m_sock.native_handle(), name.c_str());
}

View File

@ -327,12 +327,6 @@ namespace libtorrent {
return;
}
if (ec && ec != boost::asio::error::eof)
{
fail(ec);
return;
}
received_bytes(static_cast<int>(data.size()) + parser.body_start());
// handle tracker response

View File

@ -357,7 +357,7 @@ namespace aux {
auto* ses = reinterpret_cast<session_impl*>(arg);
const char* servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
if (!servername || strlen(servername) < 40)
if (!servername || std::strlen(servername) < 40)
return SSL_TLSEXT_ERR_ALERT_FATAL;
sha1_hash info_hash;
@ -7143,7 +7143,7 @@ namespace aux {
}
void tracker_logger::tracker_request_error(tracker_request const&
, error_code const& ec, const std::string& str
, error_code const& ec, std::string const& str
, seconds32 const retry_interval)
{
TORRENT_UNUSED(retry_interval);

View File

@ -292,9 +292,9 @@ namespace libtorrent {
}
// we need to post the error to avoid deadlock
if (std::shared_ptr<request_callback> r = c.lock())
if (auto r = c.lock())
ios.post(std::bind(&request_callback::tracker_request_error, r, std::move(req)
, error_code(errors::unsupported_url_protocol)
, errors::unsupported_url_protocol
, "", seconds32(0)));
}