diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-11-25 15:49:20 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-11-25 15:49:20 +0000 |
| commit | 46d9f2de6373007895e84f577aa8ae413cd4e861 (patch) | |
| tree | 5ab170329d937cb4fea2f04c76675062b832d0f5 /src/BtRegistry.h | |
| parent | a26a44cb8ed28d59930bfaa4553fbd1fa7fbcb4d (diff) | |
2009-11-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug which causes segmentation fault with tellWaiting
XML-RPC method when BitTorrent download is waiting. The key of
BtRegistry is changed from info hash to GID, because it is
registered per RequestGroup, not info hash.
* src/BtRegistry.cc
* src/BtRegistry.h
* src/BtSetup.cc
* src/ConsoleStatCalc.cc
* src/InitiatorMSEHandshakeCommand.cc
* src/PeerInitiateConnectionCommand.cc
* src/PeerInteractionCommand.cc
* src/PeerInteractionCommand.h
* src/PeerReceiveHandshakeCommand.cc
* src/RequestGroup.cc
* src/XmlRpcMethodImpl.cc
* test/BtRegistryTest.cc
* test/XmlRpcMethodTest.cc
Diffstat (limited to 'src/BtRegistry.h')
| -rw-r--r-- | src/BtRegistry.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/BtRegistry.h b/src/BtRegistry.h index 3b3858f8..3fc642ee 100644 --- a/src/BtRegistry.h +++ b/src/BtRegistry.h @@ -37,7 +37,6 @@ #include "common.h" -#include <string> #include <map> #include "SharedHandle.h" @@ -87,19 +86,22 @@ struct BtObject { class BtRegistry { private: - std::map<std::string, BtObject> _pool; + std::map<int32_t, BtObject> _pool; public: SharedHandle<DownloadContext> + getDownloadContext(int32_t gid) const; + + SharedHandle<DownloadContext> getDownloadContext(const std::string& infoHash) const; - void put(const std::string& infoHash, const BtObject& obj); + void put(int32_t gid, const BtObject& obj); - BtObject get(const std::string& infoHash) const; + BtObject get(int32_t gid) const; template<typename OutputIterator> OutputIterator getAllDownloadContext(OutputIterator dest) { - for(std::map<std::string, BtObject>::const_iterator i = _pool.begin(); + for(std::map<int32_t, BtObject>::const_iterator i = _pool.begin(); i != _pool.end(); ++i) { *dest++ = (*i).second._downloadContext; } @@ -108,7 +110,7 @@ public: void removeAll(); - bool remove(const std::string& infoHash); + bool remove(int32_t gid); }; } // namespace aria2 |
