DefaultBtMessageReceiver: Use raw pointer for non-owning object

pull/103/head
Tatsuhiro Tsujikawa 2013-06-23 12:29:18 +09:00
parent 85f5134626
commit a18bba7c66
3 changed files with 6 additions and 5 deletions

View File

@ -55,6 +55,7 @@ namespace aria2 {
DefaultBtMessageReceiver::DefaultBtMessageReceiver():
handshakeSent_(false),
downloadContext_{0},
peerConnection_(0),
dispatcher_(0),
messageFactory_(0)
@ -132,7 +133,7 @@ std::shared_ptr<BtMessage> DefaultBtMessageReceiver::receiveMessage() {
}
void DefaultBtMessageReceiver::setDownloadContext
(const std::shared_ptr<DownloadContext>& downloadContext)
(DownloadContext* downloadContext)
{
downloadContext_ = downloadContext;
}

View File

@ -49,7 +49,7 @@ class BtMessageFactory;
class DefaultBtMessageReceiver : public BtMessageReceiver {
private:
bool handshakeSent_;
std::shared_ptr<DownloadContext> downloadContext_;
DownloadContext* downloadContext_;
PeerConnection* peerConnection_;
BtMessageDispatcher* dispatcher_;
BtMessageFactory* messageFactory_;
@ -65,7 +65,7 @@ public:
virtual std::shared_ptr<BtMessage> receiveMessage();
void setDownloadContext(const std::shared_ptr<DownloadContext>& downloadContext);
void setDownloadContext(DownloadContext* downloadContext);
void setPeerConnection(PeerConnection* peerConnection);

View File

@ -204,11 +204,11 @@ PeerInteractionCommand::PeerInteractionCommand
std::shared_ptr<BtMessageDispatcher> dispatcher(dispatcherPtr);
DefaultBtMessageReceiver* receiverPtr(new DefaultBtMessageReceiver());
receiverPtr->setDownloadContext(requestGroup_->getDownloadContext());
std::shared_ptr<BtMessageReceiver> receiver(receiverPtr);
receiverPtr->setDownloadContext(requestGroup_->getDownloadContext().get());
receiverPtr->setPeerConnection(peerConnection.get());
receiverPtr->setDispatcher(dispatcherPtr);
receiverPtr->setBtMessageFactory(factoryPtr);
std::shared_ptr<BtMessageReceiver> receiver(receiverPtr);
DefaultBtRequestFactory* reqFactoryPtr(new DefaultBtRequestFactory());
reqFactoryPtr->setPeer(getPeer());