Merge pull request #1045 from aldenml/minor-refactor-1.2
no warnings in random with openssl-1.1 and minor refactor
This commit is contained in:
commit
c77f339067
|
@ -357,7 +357,7 @@ namespace libtorrent
|
|||
void dht_announce(sha1_hash const& info_hash, int port = 0, int flags = 0);
|
||||
|
||||
void dht_direct_request(udp::endpoint ep, entry& e
|
||||
, void* userdata = 0);
|
||||
, void* userdata = nullptr);
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
entry dht_state() const;
|
||||
|
|
|
@ -47,8 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/time.hpp"
|
||||
|
||||
namespace libtorrent { namespace aux { struct session_impl; } }
|
||||
|
||||
namespace libtorrent { struct dht_settings; class entry; }
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
|
|
|
@ -422,7 +422,7 @@ namespace libtorrent
|
|||
// the DHT works, it is natural to always do a lookup before storing and
|
||||
// calling the callback in between is convenient.
|
||||
void dht_put_item(std::array<char, 32> key
|
||||
, std::function<void(entry&, std::array<char,64>&
|
||||
, std::function<void(entry&, std::array<char, 64>&
|
||||
, std::uint64_t&, std::string const&)> cb
|
||||
, std::string salt = std::string());
|
||||
|
||||
|
@ -435,7 +435,7 @@ namespace libtorrent
|
|||
// with the response (if any) and the userdata pointer passed in here.
|
||||
// Since this alert is a response to an explicit call, it will always be
|
||||
// posted, regardless of the alert mask.
|
||||
void dht_direct_request(udp::endpoint ep, entry const& e, void* userdata = 0);
|
||||
void dht_direct_request(udp::endpoint ep, entry const& e, void* userdata = nullptr);
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 0.15
|
||||
|
|
|
@ -197,7 +197,7 @@ std::string node::generate_token(udp::endpoint const& addr
|
|||
h.update(info_hash);
|
||||
|
||||
sha1_hash const hash = h.final();
|
||||
std::copy(hash.begin(), hash.begin() + 4, reinterpret_cast<char*>(&token[0]));
|
||||
std::copy(hash.begin(), hash.begin() + 4, token.begin());
|
||||
TORRENT_ASSERT(std::equal(token.begin(), token.end(), hash.data()));
|
||||
return token;
|
||||
}
|
||||
|
@ -866,11 +866,11 @@ void node::incoming_request(msg const& m, entry& e)
|
|||
return;
|
||||
}
|
||||
|
||||
reply["token"] = generate_token(m.addr, sha1_hash(msg_keys[0].string_ptr()));
|
||||
sha1_hash const info_hash(msg_keys[0].string_ptr());
|
||||
reply["token"] = generate_token(m.addr, info_hash);
|
||||
|
||||
m_counters.inc_stats_counter(counters::dht_get_peers_in);
|
||||
|
||||
sha1_hash info_hash(msg_keys[0].string_ptr());
|
||||
// always return nodes as well as peers
|
||||
write_nodes_entries(info_hash, msg_keys[3], reply);
|
||||
|
||||
|
|
|
@ -510,4 +510,3 @@ observer::~observer()
|
|||
}
|
||||
|
||||
} } // namespace libtorrent::dht
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#if TORRENT_USE_CRYPTOAPI
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
|
@ -46,6 +48,8 @@ extern "C" {
|
|||
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
namespace aux
|
||||
|
|
|
@ -567,7 +567,7 @@ namespace aux {
|
|||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
for (auto& ext : m_ses_extensions[plugins_all_idx])
|
||||
for (auto const& ext : m_ses_extensions[plugins_all_idx])
|
||||
{
|
||||
TORRENT_TRY {
|
||||
ext->save_state(*eptr);
|
||||
|
@ -6589,7 +6589,7 @@ namespace aux {
|
|||
, dht::msg const& request, entry& response)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
for (auto& ext : m_ses_extensions[plugins_dht_request_idx])
|
||||
for (auto const& ext : m_ses_extensions[plugins_dht_request_idx])
|
||||
{
|
||||
if (ext->on_dht_request(query
|
||||
, request.addr, request.message, response))
|
||||
|
@ -6875,7 +6875,7 @@ namespace aux {
|
|||
i != resp.peers.end(); ++i)
|
||||
{
|
||||
debug_log(" %16s %5d %s %s", i->hostname.c_str(), i->port
|
||||
, i->pid.is_all_zeros()?"":to_hex(i->pid).c_str()
|
||||
, i->pid.is_all_zeros() ? "" : to_hex(i->pid).c_str()
|
||||
, identify_client(i->pid).c_str());
|
||||
}
|
||||
for (std::vector<ipv4_peer_entry>::const_iterator i = resp.peers4.begin();
|
||||
|
|
Loading…
Reference in New Issue