summaryrefslogtreecommitdiff
path: root/src/PeerReceiveHandshakeCommand.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/PeerReceiveHandshakeCommand.cc
parentbb5b7eeedb3ce7396007818cbab4f5f5660997a5 (diff)
Wrap Command object in std::unique_ptr
Diffstat (limited to 'src/PeerReceiveHandshakeCommand.cc')
-rw-r--r--src/PeerReceiveHandshakeCommand.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/PeerReceiveHandshakeCommand.cc b/src/PeerReceiveHandshakeCommand.cc
index 5cdd51c3..283ca4d7 100644
--- a/src/PeerReceiveHandshakeCommand.cc
+++ b/src/PeerReceiveHandshakeCommand.cc
@@ -142,8 +142,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
// that the added peer must be checked out.
if(peerStorage->addPeer(getPeer()) &&
peerStorage->checkoutPeer(getCuid())) {
- PeerInteractionCommand* command =
- new PeerInteractionCommand
+ getDownloadEngine()->addCommand(make_unique<PeerInteractionCommand>
(getCuid(),
downloadContext->getOwnerRequestGroup(),
getPeer(),
@@ -153,8 +152,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
peerStorage,
getSocket(),
PeerInteractionCommand::RECEIVER_WAIT_HANDSHAKE,
- peerConnection_);
- getDownloadEngine()->addCommand(command);
+ peerConnection_));
A2_LOG_DEBUG(fmt(MSG_INCOMING_PEER_CONNECTION,
getCuid(),
getPeer()->usedBy()));
@@ -162,7 +160,7 @@ bool PeerReceiveHandshakeCommand::executeInternal()
}
return true;
} else {
- getDownloadEngine()->addCommand(this);
+ addCommandSelf();
return false;
}
}