summaryrefslogtreecommitdiff
path: root/src/ActivePeerConnectionCommand.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/ActivePeerConnectionCommand.cc
parentbb5b7eeedb3ce7396007818cbab4f5f5660997a5 (diff)
Wrap Command object in std::unique_ptr
Diffstat (limited to 'src/ActivePeerConnectionCommand.cc')
-rw-r--r--src/ActivePeerConnectionCommand.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ActivePeerConnectionCommand.cc b/src/ActivePeerConnectionCommand.cc
index 07ae4d5f..311daf1a 100644
--- a/src/ActivePeerConnectionCommand.cc
+++ b/src/ActivePeerConnectionCommand.cc
@@ -123,7 +123,7 @@ bool ActivePeerConnectionCommand::execute() {
}
}
}
- e_->addCommand(this);
+ e_->addCommand(std::unique_ptr<Command>(this));
return false;
}
@@ -136,12 +136,11 @@ void ActivePeerConnectionCommand::makeNewConnections(int num)
if(!peer) {
break;
}
- PeerInitiateConnectionCommand* command;
- command = new PeerInitiateConnectionCommand(ncuid, requestGroup_, peer, e_,
- btRuntime_);
+ auto command = make_unique<PeerInitiateConnectionCommand>
+ (ncuid, requestGroup_, peer, e_, btRuntime_);
command->setPeerStorage(peerStorage_);
command->setPieceStorage(pieceStorage_);
- e_->addCommand(command);
+ e_->addCommand(std::move(command));
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_PEER, getCuid(),
peer->getIPAddress().c_str()));
}