mirror of https://github.com/aria2/aria2
DefaultBtMessageReceiver: Use raw pointer for non-owning object
parent
85f5134626
commit
a18bba7c66
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue