summaryrefslogtreecommitdiff
path: root/src/HttpRequestCommand.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/HttpRequestCommand.cc
parentbb5b7eeedb3ce7396007818cbab4f5f5660997a5 (diff)
Wrap Command object in std::unique_ptr
Diffstat (limited to 'src/HttpRequestCommand.cc')
-rw-r--r--src/HttpRequestCommand.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc
index 620dbf7d..53f73007 100644
--- a/src/HttpRequestCommand.cc
+++ b/src/HttpRequestCommand.cc
@@ -130,7 +130,7 @@ bool HttpRequestCommand::executeInternal() {
if(!getSocket()->tlsConnect(getRequest()->getHost())) {
setReadCheckSocketIf(getSocket(), getSocket()->wantRead());
setWriteCheckSocketIf(getSocket(), getSocket()->wantWrite());
- getDownloadEngine()->addCommand(this);
+ addCommandSelf();
return false;
}
}
@@ -207,19 +207,19 @@ bool HttpRequestCommand::executeInternal() {
httpConnection_->sendPendingData();
}
if(httpConnection_->sendBufferIsEmpty()) {
- Command* command = new HttpResponseCommand(getCuid(),
- getRequest(),
- getFileEntry(),
- getRequestGroup(),
- httpConnection_,
- getDownloadEngine(),
- getSocket());
- getDownloadEngine()->addCommand(command);
+ getDownloadEngine()->addCommand(make_unique<HttpResponseCommand>
+ (getCuid(),
+ getRequest(),
+ getFileEntry(),
+ getRequestGroup(),
+ httpConnection_,
+ getDownloadEngine(),
+ getSocket()));
return true;
} else {
setReadCheckSocketIf(getSocket(), getSocket()->wantRead());
setWriteCheckSocketIf(getSocket(), getSocket()->wantWrite());
- getDownloadEngine()->addCommand(this);
+ addCommandSelf();
return false;
}
}