From 46d9f2de6373007895e84f577aa8ae413cd4e861 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 25 Nov 2009 15:49:20 +0000 Subject: 2009-11-26 Tatsuhiro Tsujikawa 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 --- src/PeerInteractionCommand.cc | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/PeerInteractionCommand.cc') diff --git a/src/PeerInteractionCommand.cc b/src/PeerInteractionCommand.cc index 5cbf025f..5255fe0e 100644 --- a/src/PeerInteractionCommand.cc +++ b/src/PeerInteractionCommand.cc @@ -45,7 +45,6 @@ #include "Socket.h" #include "Option.h" #include "DownloadContext.h" -#include "BtRegistry.h" #include "Peer.h" #include "BtMessage.h" #include "BtRuntime.h" @@ -83,6 +82,7 @@ PeerInteractionCommand::PeerInteractionCommand DownloadEngine* e, const SharedHandle& btRuntime, const SharedHandle& pieceStorage, + const SharedHandle& peerStorage, const SocketHandle& s, Seq sequence, const PeerConnectionHandle& passedPeerConnection) @@ -90,6 +90,7 @@ PeerInteractionCommand::PeerInteractionCommand _requestGroup(requestGroup), _btRuntime(btRuntime), _pieceStorage(pieceStorage), + _peerStorage(peerStorage), sequence(sequence) { // TODO move following bunch of processing to separate method, like init() @@ -101,9 +102,6 @@ PeerInteractionCommand::PeerInteractionCommand const BDE& torrentAttrs = _requestGroup->getDownloadContext()->getAttribute(bittorrent::BITTORRENT); - SharedHandle btRegistry = e->getBtRegistry(); - SharedHandle peerStorage = - btRegistry->get(torrentAttrs[bittorrent::INFO_HASH].s())._peerStorage; bool metadataGetMode = !torrentAttrs.containsKey(bittorrent::METADATA); @@ -354,12 +352,6 @@ bool PeerInteractionCommand::exitBeforeExecute() return _btRuntime->isHalt(); } -void PeerInteractionCommand::setPeerStorage -(const SharedHandle& peerStorage) -{ - _peerStorage = peerStorage; -} - const SharedHandle