* Converted VariableMap and ViewManager to using const char* as the

key, since they are never changed nor added from outside. This cut the
stripped binary size by 50KB.

* Use a shared have piece queue for each download. Each connection has
a time-stamp for the last have message they sent, which is checked
against the queue. This also avoids the race condition where some
peers would get incomplete views of our bitfield due to lost have
messages during handshake.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@839 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-01-01 14:57:10 +00:00
parent fe7adfc999
commit de744ad11d
8 changed files with 72 additions and 52 deletions
+7 -2
View File
@@ -38,6 +38,7 @@
#define RTORRENT_CORE_VIEW_MANAGER_H
#include <map>
#include <cstring>
#include <string>
#include <rak/unordered_vector.h>
@@ -45,17 +46,21 @@
namespace core {
struct view_manager_comp : public std::binary_function<const char*, const char*, bool> {
bool operator () (const char* arg1, const char* arg2) const { return std::strcmp(arg1, arg2) < 0; }
};
class ViewSort;
class ViewManager : public rak::unordered_vector<View*> {
public:
typedef rak::unordered_vector<View*> base_type;
typedef std::map<std::string, ViewSort*> sort_map;
typedef std::map<const char*, ViewSort*, view_manager_comp> sort_map;
typedef View::sort_list sort_list;
typedef std::list<std::string> sort_args;
typedef std::map<std::string, ViewFilter*> filter_map;
typedef std::map<const char*, ViewFilter*, view_manager_comp> filter_map;
typedef View::filter_list filter_list;
typedef std::list<std::string> filter_args;