forked from premiere/premiere-libtorrent
simplify trigger_unchoke and trigger_optimistic_unchoke on session_impl, abd make them noexcept
This commit is contained in:
parent
94dcd8e14b
commit
b6a73eeaaa
|
@ -549,12 +549,12 @@ namespace aux {
|
||||||
|
|
||||||
int peak_up_rate() const { return m_peak_up_rate; }
|
int peak_up_rate() const { return m_peak_up_rate; }
|
||||||
|
|
||||||
void trigger_unchoke() override
|
void trigger_unchoke() noexcept override
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
m_unchoke_time_scaler = 0;
|
m_unchoke_time_scaler = 0;
|
||||||
}
|
}
|
||||||
void trigger_optimistic_unchoke() override
|
void trigger_optimistic_unchoke() noexcept override
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
m_optimistic_unchoke_time_scaler = 0;
|
m_optimistic_unchoke_time_scaler = 0;
|
||||||
|
|
|
@ -186,8 +186,8 @@ namespace libtorrent { namespace aux {
|
||||||
virtual bool is_aborted() const = 0;
|
virtual bool is_aborted() const = 0;
|
||||||
virtual int num_uploads() const = 0;
|
virtual int num_uploads() const = 0;
|
||||||
virtual bool preemptive_unchoke() const = 0;
|
virtual bool preemptive_unchoke() const = 0;
|
||||||
virtual void trigger_optimistic_unchoke() = 0;
|
virtual void trigger_optimistic_unchoke() noexcept = 0;
|
||||||
virtual void trigger_unchoke() = 0;
|
virtual void trigger_unchoke() noexcept = 0;
|
||||||
|
|
||||||
virtual std::weak_ptr<torrent> find_torrent(sha1_hash const& info_hash) const = 0;
|
virtual std::weak_ptr<torrent> find_torrent(sha1_hash const& info_hash) const = 0;
|
||||||
virtual std::weak_ptr<torrent> find_disconnect_candidate_torrent() const = 0;
|
virtual std::weak_ptr<torrent> find_disconnect_candidate_torrent() const = 0;
|
||||||
|
|
|
@ -33,12 +33,12 @@ namespace libtorrent {
|
||||||
}
|
}
|
||||||
catch (std::exception const& err)
|
catch (std::exception const& err)
|
||||||
{
|
{
|
||||||
std::fprintf(stderr, "invariant_check failed with exception: %s"
|
std::fprintf(stderr, "invariant_check failed with exception: %s\n"
|
||||||
, err.what());
|
, err.what());
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::fprintf(stderr, "invariant_check failed with exception");
|
std::fprintf(stderr, "invariant_check failed with exception\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
invariant_access::check_invariant(x);
|
invariant_access::check_invariant(x);
|
||||||
|
|
|
@ -642,8 +642,8 @@ namespace libtorrent {
|
||||||
bool choke_peer(peer_connection& c);
|
bool choke_peer(peer_connection& c);
|
||||||
bool unchoke_peer(peer_connection& c, bool optimistic = false);
|
bool unchoke_peer(peer_connection& c, bool optimistic = false);
|
||||||
|
|
||||||
void trigger_unchoke();
|
void trigger_unchoke() noexcept;
|
||||||
void trigger_optimistic_unchoke();
|
void trigger_optimistic_unchoke() noexcept;
|
||||||
|
|
||||||
// used by peer_connection to attach itself to a torrent
|
// used by peer_connection to attach itself to a torrent
|
||||||
// since incoming connections don't know what torrent
|
// since incoming connections don't know what torrent
|
||||||
|
|
|
@ -5296,16 +5296,14 @@ namespace libtorrent {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::trigger_unchoke()
|
void torrent::trigger_unchoke() noexcept
|
||||||
{
|
{
|
||||||
m_ses.get_io_service().dispatch(std::bind(
|
m_ses.trigger_unchoke();
|
||||||
&aux::session_interface::trigger_unchoke, std::ref(m_ses)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::trigger_optimistic_unchoke()
|
void torrent::trigger_optimistic_unchoke() noexcept
|
||||||
{
|
{
|
||||||
m_ses.get_io_service().dispatch(std::bind(
|
m_ses.trigger_optimistic_unchoke();
|
||||||
&aux::session_interface::trigger_optimistic_unchoke, std::ref(m_ses)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::cancel_block(piece_block block)
|
void torrent::cancel_block(piece_block block)
|
||||||
|
|
Loading…
Reference in New Issue