summaryrefslogtreecommitdiff
path: root/src/FtpNegotiationCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 01:10:38 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-22 01:10:38 +0900
commit07d270c87e6f9184aea4ca17eb26e466712e8db2 (patch)
tree2dfbaa2e0d2ad0f38cb73098608f7d67a64320f8 /src/FtpNegotiationCommand.cc
parent126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8 (diff)
Require -std=c++11 and use std::shared_ptr instead of SharedHandle
Diffstat (limited to 'src/FtpNegotiationCommand.cc')
-rw-r--r--src/FtpNegotiationCommand.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc
index 8ed30e5b..1845a116 100644
--- a/src/FtpNegotiationCommand.cc
+++ b/src/FtpNegotiationCommand.cc
@@ -82,11 +82,11 @@ namespace aria2 {
FtpNegotiationCommand::FtpNegotiationCommand
(cuid_t cuid,
- const SharedHandle<Request>& req,
- const SharedHandle<FileEntry>& fileEntry,
+ const std::shared_ptr<Request>& req,
+ const std::shared_ptr<FileEntry>& fileEntry,
RequestGroup* requestGroup,
DownloadEngine* e,
- const SharedHandle<SocketCore>& socket,
+ const std::shared_ptr<SocketCore>& socket,
Seq seq,
const std::string& baseWorkingDir):
AbstractCommand(cuid, req, fileEntry, requestGroup, e, socket),
@@ -401,7 +401,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
getRequestGroup()->initPieceStorage();
if(getDownloadContext()->isChecksumVerificationNeeded()) {
A2_LOG_DEBUG("Zero length file exists. Verify checksum.");
- SharedHandle<ChecksumCheckIntegrityEntry> entry
+ std::shared_ptr<ChecksumCheckIntegrityEntry> entry
(new ChecksumCheckIntegrityEntry(getRequestGroup()));
entry->initValidator();
getPieceStorage()->getDiskAdaptor()->openExistingFile();
@@ -435,7 +435,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
// HttpResponseCommand::handleOtherEncoding()
if(getDownloadContext()->isChecksumVerificationNeeded()) {
A2_LOG_DEBUG("Verify checksum for zero-length file");
- SharedHandle<ChecksumCheckIntegrityEntry> entry
+ std::shared_ptr<ChecksumCheckIntegrityEntry> entry
(new ChecksumCheckIntegrityEntry(getRequestGroup()));
entry->initValidator();
getDownloadEngine()->getCheckIntegrityMan()->pushEntry(entry);
@@ -455,9 +455,9 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
getSegmentMan()->getSegmentWithIndex(getCuid(), 0);
return true;
} else {
- SharedHandle<BtProgressInfoFile> progressInfoFile
+ std::shared_ptr<BtProgressInfoFile> progressInfoFile
(new DefaultBtProgressInfoFile
- (getDownloadContext(), SharedHandle<PieceStorage>(), getOption().get()));
+ (getDownloadContext(), std::shared_ptr<PieceStorage>(), getOption().get()));
getRequestGroup()->adjustFilename(progressInfoFile);
getRequestGroup()->initPieceStorage();
@@ -466,7 +466,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(int64_t totalLength)
return false;
}
- SharedHandle<CheckIntegrityEntry> checkIntegrityEntry =
+ std::shared_ptr<CheckIntegrityEntry> checkIntegrityEntry =
getRequestGroup()->createCheckIntegrityEntry();
if(!checkIntegrityEntry) {
sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
@@ -684,7 +684,7 @@ bool FtpNegotiationCommand::preparePasvConnect() {
bool FtpNegotiationCommand::resolveProxy()
{
- SharedHandle<Request> proxyReq = createProxyRequest();
+ std::shared_ptr<Request> proxyReq = createProxyRequest();
std::vector<std::string> addrs;
proxyAddr_ = resolveHostname
(addrs, proxyReq->getHost(), proxyReq->getPort());
@@ -698,7 +698,7 @@ bool FtpNegotiationCommand::resolveProxy()
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
disableReadCheckSocket();
setWriteCheckSocket(dataSocket_);
- SharedHandle<SocketRecvBuffer> socketRecvBuffer
+ std::shared_ptr<SocketRecvBuffer> socketRecvBuffer
(new SocketRecvBuffer(dataSocket_));
http_.reset(new HttpConnection(getCuid(), dataSocket_, socketRecvBuffer));
sequence_ = SEQ_SEND_TUNNEL_REQUEST;
@@ -711,7 +711,7 @@ bool FtpNegotiationCommand::sendTunnelRequest()
if(dataSocket_->isReadable(0)) {
std::string error = getSocket()->getSocketError();
if(!error.empty()) {
- SharedHandle<Request> proxyReq = createProxyRequest();
+ std::shared_ptr<Request> proxyReq = createProxyRequest();
getDownloadEngine()->markBadIPAddress(proxyReq->getHost(),
proxyAddr_,proxyReq->getPort());
std::string nextProxyAddr = getDownloadEngine()->findCachedIPAddress
@@ -735,9 +735,9 @@ bool FtpNegotiationCommand::sendTunnelRequest()
}
}
}
- SharedHandle<HttpRequest> httpRequest(new HttpRequest());
+ std::shared_ptr<HttpRequest> httpRequest(new HttpRequest());
httpRequest->setUserAgent(getOption()->get(PREF_USER_AGENT));
- SharedHandle<Request> req(new Request());
+ std::shared_ptr<Request> req(new Request());
// Construct fake URI in order to use HttpRequest
std::pair<std::string, uint16_t> dataAddr;
uri::UriStruct us;
@@ -767,7 +767,7 @@ bool FtpNegotiationCommand::sendTunnelRequest()
bool FtpNegotiationCommand::recvTunnelResponse()
{
- SharedHandle<HttpResponse> httpResponse = http_->receiveResponse();
+ std::shared_ptr<HttpResponse> httpResponse = http_->receiveResponse();
if(!httpResponse) {
return false;
}
@@ -778,7 +778,7 @@ bool FtpNegotiationCommand::recvTunnelResponse()
return true;
}
-bool FtpNegotiationCommand::sendRestPasv(const SharedHandle<Segment>& segment) {
+bool FtpNegotiationCommand::sendRestPasv(const std::shared_ptr<Segment>& segment) {
//dataSocket_->setBlockingMode();
// Check connection is made properly
if(dataSocket_->isReadable(0)) {
@@ -792,7 +792,7 @@ bool FtpNegotiationCommand::sendRestPasv(const SharedHandle<Segment>& segment) {
return sendRest(segment);
}
-bool FtpNegotiationCommand::sendRest(const SharedHandle<Segment>& segment) {
+bool FtpNegotiationCommand::sendRest(const std::shared_ptr<Segment>& segment) {
if(ftp_->sendRest(segment)) {
disableWriteCheckSocket();
sequence_ = SEQ_RECV_REST;
@@ -802,7 +802,7 @@ bool FtpNegotiationCommand::sendRest(const SharedHandle<Segment>& segment) {
return false;
}
-bool FtpNegotiationCommand::recvRest(const SharedHandle<Segment>& segment) {
+bool FtpNegotiationCommand::recvRest(const std::shared_ptr<Segment>& segment) {
int status = ftp_->receiveResponse();
if(status == 0) {
return false;
@@ -864,7 +864,7 @@ bool FtpNegotiationCommand::waitConnection()
}
bool FtpNegotiationCommand::processSequence
-(const SharedHandle<Segment>& segment) {
+(const std::shared_ptr<Segment>& segment) {
bool doNextSequence = true;
switch(sequence_) {
case SEQ_RECV_GREETING: