* Removed duplicate portions of some rak/ headers.

* Properly set uninterested when the peer doesn't have any more pieces
we're interested in.

* #180, the ResourceManager didn't iterate over downloads with weight
0, causing those with priority off to not to perform choking nor get
counted in the total.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@649 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-03-10 15:51:25 +00:00
parent 6822261199
commit 2863c10389
2 changed files with 20 additions and 7 deletions
+9 -3
View File
@@ -44,6 +44,12 @@ namespace rak {
class error_number {
public:
static const int e_again = EAGAIN;
static const int e_intr = EINTR;
static const int e_deadlk = EDEADLK;
static const int e_connreset = ECONNRESET;
static const int e_connaborted = ECONNABORTED;
error_number() : m_errno(0) {}
error_number(int e) : m_errno(e) {}
@@ -52,10 +58,10 @@ public:
int value() const { return m_errno; }
const char* c_str() const { return strerror(m_errno); }
bool is_blocked_momentary() const { return m_errno == EAGAIN || m_errno == EINTR; }
bool is_blocked_prolonged() const { return m_errno == EDEADLK; }
bool is_blocked_momentary() const { return m_errno == e_again || m_errno == e_intr; }
bool is_blocked_prolonged() const { return m_errno == e_deadlk; }
bool is_closed() const { return m_errno == ECONNRESET || m_errno == ECONNABORTED; }
bool is_closed() const { return m_errno == e_connreset || m_errno == e_connaborted; }
static error_number current() { return errno; }
static void clear_global() { errno = 0; }
+11 -4
View File
@@ -67,13 +67,14 @@ public:
// void erase(value_type r);
// Find the first ranges that has an end greater than index.
inline iterator find(Type index);
iterator find(Type index);
const_iterator find(Type index) const;
// Use find with no closest match.
inline bool has(Type index);
bool has(Type index) const;
private:
inline void unify(iterator itr);
void unify(iterator itr);
};
template <typename Type>
@@ -109,10 +110,16 @@ ranges<Type>::find(Type index) {
return std::find_if(begin(), end(), rak::less(index, rak::mem_ptr_ref(&value_type::second)));
}
template <typename Type>
inline typename ranges<Type>::const_iterator
ranges<Type>::find(Type index) const {
return std::find_if(begin(), end(), rak::less(index, rak::mem_ptr_ref(&value_type::second)));
}
// Use find with no closest match.
template <typename Type>
inline bool
ranges<Type>::has(Type index) {
ranges<Type>::has(Type index) const {
const_iterator itr = find(index);
return itr != end() && index >= itr->first;