forked from premiere/premiere-libtorrent
minor general code cleanup and refactor
This commit is contained in:
parent
ff038fb548
commit
f80e95705a
|
@ -51,8 +51,8 @@ namespace libtorrent
|
|||
explicit announce_entry(string_view u);
|
||||
announce_entry();
|
||||
~announce_entry();
|
||||
announce_entry(announce_entry const&) = default;
|
||||
announce_entry& operator=(announce_entry const&) = default;
|
||||
announce_entry(announce_entry const&);
|
||||
announce_entry& operator=(announce_entry const&);
|
||||
|
||||
// tracker URL as it appeared in the torrent file
|
||||
std::string url;
|
||||
|
|
|
@ -62,4 +62,3 @@ namespace aux {
|
|||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <map>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <cstdint>
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
|
|
|
@ -34,13 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_RESOLVER_HPP_INCLUDE
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
@ -73,8 +70,7 @@ private:
|
|||
std::vector<address> addresses;
|
||||
};
|
||||
|
||||
using cache_t = std::unordered_map<std::string, dns_cache_entry>;
|
||||
cache_t m_cache;
|
||||
std::unordered_map<std::string, dns_cache_entry> m_cache;
|
||||
io_service& m_ios;
|
||||
|
||||
// all lookups in this resolver are aborted on shutdown.
|
||||
|
|
|
@ -44,13 +44,12 @@ namespace libtorrent
|
|||
|
||||
struct TORRENT_EXTRA_EXPORT resolver_interface
|
||||
{
|
||||
typedef std::function<void(error_code const&, std::vector<address> const&)>
|
||||
callback_t;
|
||||
using callback_t = std::function<void(error_code const&, std::vector<address> const&)>;
|
||||
|
||||
enum flags_t
|
||||
{
|
||||
// this flag will make async_resolve() always use the cache if we have an
|
||||
// entry, regardless of how old it is. This is usefull when completing the
|
||||
// entry, regardless of how old it is. This is useful when completing the
|
||||
// lookup quickly is more important than accuracy
|
||||
prefer_cache = 1,
|
||||
|
||||
|
@ -70,4 +69,3 @@ protected:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_SPAN_HPP_INCLUDED
|
||||
#define TORRENT_SPAN_HPP_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <type_traits> // for std::is_convertible
|
||||
#include <type_traits>
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace libtorrent
|
|||
{}
|
||||
|
||||
announce_entry::~announce_entry() = default;
|
||||
announce_entry::announce_entry(announce_entry const&) = default;
|
||||
announce_entry& announce_entry::operator=(announce_entry const&) = default;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
int announce_entry::next_announce_in() const
|
||||
|
|
|
@ -34,8 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/debug.hpp"
|
||||
#include "libtorrent/aux_/time.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
resolver::resolver(io_service& ios)
|
||||
|
@ -73,9 +71,8 @@ namespace libtorrent
|
|||
// oldest entries
|
||||
if (int(m_cache.size()) > m_max_size)
|
||||
{
|
||||
cache_t::iterator oldest = m_cache.begin();
|
||||
for (cache_t::iterator k = m_cache.begin();
|
||||
k != m_cache.end(); ++k)
|
||||
auto oldest = m_cache.begin();
|
||||
for (auto k = m_cache.begin(); k != m_cache.end(); ++k)
|
||||
{
|
||||
if (k->second.last_seen < oldest->second.last_seen)
|
||||
oldest = k;
|
||||
|
|
|
@ -35,12 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/file.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
class file_storage;
|
||||
|
||||
stat_cache::stat_cache() {}
|
||||
stat_cache::~stat_cache() = default;
|
||||
|
||||
|
|
|
@ -63,6 +63,4 @@ namespace libtorrent { namespace aux
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue