summaryrefslogtreecommitdiff
path: root/src/PeerInteractionCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-23 21:55:52 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-23 21:55:52 +0900
commitfa9f3fb5a3c8912a0a6880ffba9c72f4424ea044 (patch)
treedeb0b47b085a3a689bf386409734bfd3f72f57d2 /src/PeerInteractionCommand.cc
parentbb5b7eeedb3ce7396007818cbab4f5f5660997a5 (diff)
Wrap Command object in std::unique_ptr
Diffstat (limited to 'src/PeerInteractionCommand.cc')
-rw-r--r--src/PeerInteractionCommand.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/PeerInteractionCommand.cc b/src/PeerInteractionCommand.cc
index 8aba2f85..f4940435 100644
--- a/src/PeerInteractionCommand.cc
+++ b/src/PeerInteractionCommand.cc
@@ -384,7 +384,7 @@ bool PeerInteractionCommand::executeInternal() {
if(btInteractive_->countPendingMessage() > 0) {
setNoCheck(true);
}
- getDownloadEngine()->addCommand(this);
+ addCommandSelf();
return false;
}
@@ -395,13 +395,11 @@ bool PeerInteractionCommand::prepareForNextPeer(time_t wait) {
std::shared_ptr<Peer> peer = peerStorage_->checkoutPeer(ncuid);
// sanity check
if(peer) {
- PeerInitiateConnectionCommand* command;
- command = new PeerInitiateConnectionCommand(ncuid, requestGroup_, peer,
- getDownloadEngine(),
- btRuntime_);
+ auto command = make_unique<PeerInitiateConnectionCommand>
+ (ncuid, requestGroup_, peer, getDownloadEngine(), btRuntime_);
command->setPeerStorage(peerStorage_);
command->setPieceStorage(pieceStorage_);
- getDownloadEngine()->addCommand(command);
+ getDownloadEngine()->addCommand(std::move(command));
}
}
return true;