mirror of https://github.com/aria2/aria2
Removed *Handle typedef
parent
1c57a3ff9f
commit
3258614033
|
@ -41,12 +41,14 @@ AbstractAuthResolver::AbstractAuthResolver() {}
|
|||
|
||||
AbstractAuthResolver::~AbstractAuthResolver() {}
|
||||
|
||||
void AbstractAuthResolver::setUserDefinedAuthConfig(const AuthConfigHandle& authConfig)
|
||||
void AbstractAuthResolver::setUserDefinedAuthConfig
|
||||
(const SharedHandle<AuthConfig>& authConfig)
|
||||
{
|
||||
userDefinedAuthConfig_ = authConfig;
|
||||
}
|
||||
|
||||
void AbstractAuthResolver::setDefaultAuthConfig(const AuthConfigHandle& authConfig)
|
||||
void AbstractAuthResolver::setDefaultAuthConfig
|
||||
(const SharedHandle<AuthConfig>& authConfig)
|
||||
{
|
||||
defaultAuthConfig_ = authConfig;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef SharedHandle<AbstractAuthResolver> AbstractAuthResolverHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_ABSTRACT_AUTH_RESOLVER_H
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
virtual void doReceivedAction() {}
|
||||
|
||||
virtual void validate();
|
||||
|
||||
|
||||
virtual void onQueued() {}
|
||||
|
||||
virtual void onAbortOutstandingRequestEvent
|
||||
|
@ -183,8 +183,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<AbstractBtMessage> AbstractBtMessageHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_ABSTRACT_BT_MESSAGE_H
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "SleepCommand.h"
|
||||
#include "StreamCheckIntegrityEntry.h"
|
||||
#include "PieceStorage.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "fmt.h"
|
||||
|
@ -82,7 +82,7 @@ AbstractCommand::AbstractCommand
|
|||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s,
|
||||
const SharedHandle<SocketCore>& s,
|
||||
const SharedHandle<SocketRecvBuffer>& socketRecvBuffer,
|
||||
bool incNumConnection)
|
||||
: Command(cuid), checkPoint_(global::wallclock()),
|
||||
|
@ -475,10 +475,11 @@ void AbstractCommand::disableReadCheckSocket() {
|
|||
e_->deleteSocketForReadCheck(readCheckTarget_, this);
|
||||
checkSocketIsReadable_ = false;
|
||||
readCheckTarget_.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractCommand::setReadCheckSocket(const SocketHandle& socket) {
|
||||
void AbstractCommand::setReadCheckSocket
|
||||
(const SharedHandle<SocketCore>& socket) {
|
||||
if(!socket->isOpen()) {
|
||||
disableReadCheckSocket();
|
||||
} else {
|
||||
|
@ -514,7 +515,8 @@ void AbstractCommand::disableWriteCheckSocket() {
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractCommand::setWriteCheckSocket(const SocketHandle& socket) {
|
||||
void AbstractCommand::setWriteCheckSocket
|
||||
(const SharedHandle<SocketCore>& socket) {
|
||||
if(!socket->isOpen()) {
|
||||
disableWriteCheckSocket();
|
||||
} else {
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "Segment.h"
|
||||
#include "Option.h"
|
||||
#include "prefs.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "DownloadContext.h"
|
||||
#include "SocketRecvBuffer.h"
|
||||
|
||||
|
@ -54,7 +54,7 @@ AbstractProxyRequestCommand::AbstractProxyRequestCommand
|
|||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SharedHandle<Request>& proxyRequest,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:
|
||||
AbstractCommand(cuid, req, fileEntry, requestGroup, e, s),
|
||||
proxyRequest_(proxyRequest),
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "HttpRequest.h"
|
||||
#include "HttpResponse.h"
|
||||
#include "HttpRequestCommand.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "DlRetryEx.h"
|
||||
#include "message.h"
|
||||
#include "HttpHeader.h"
|
||||
|
@ -55,9 +55,9 @@ AbstractProxyResponseCommand::AbstractProxyResponseCommand
|
|||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:AbstractCommand(cuid, req, fileEntry, requestGroup, e, s),
|
||||
httpConnection_(httpConnection) {}
|
||||
|
||||
|
|
|
@ -146,9 +146,9 @@ void AbstractSingleDiskAdaptor::cutTrailingGarbage()
|
|||
diskWriter_->truncate(totalLength_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AbstractSingleDiskAdaptor::setDiskWriter
|
||||
(const DiskWriterHandle& diskWriter)
|
||||
(const SharedHandle<DiskWriter>& diskWriter)
|
||||
{
|
||||
diskWriter_ = diskWriter;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ std::string AuthConfig::getAuthText() const
|
|||
return s;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const AuthConfigHandle& authConfig)
|
||||
std::ostream& operator<<(std::ostream& o,
|
||||
const SharedHandle<AuthConfig>& authConfig)
|
||||
{
|
||||
o << authConfig->getAuthText();
|
||||
return o;
|
||||
|
|
|
@ -71,9 +71,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<AuthConfig> AuthConfigHandle;
|
||||
|
||||
std::ostream& operator<<(std::ostream& o, const AuthConfigHandle& authConfig);
|
||||
std::ostream& operator<<(std::ostream& o,
|
||||
const SharedHandle<AuthConfig>& authConfig);
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ AuthConfigFactory::AuthConfigFactory() {}
|
|||
|
||||
AuthConfigFactory::~AuthConfigFactory() {}
|
||||
|
||||
AuthConfigHandle
|
||||
SharedHandle<AuthConfig>
|
||||
AuthConfigFactory::createAuthConfig
|
||||
(const SharedHandle<Request>& request, const Option* op)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ AuthConfigFactory::createAuthConfig
|
|||
}
|
||||
}
|
||||
|
||||
AuthConfigHandle
|
||||
SharedHandle<AuthConfig>
|
||||
AuthConfigFactory::createAuthConfig(const std::string& user, const std::string& password) const
|
||||
{
|
||||
SharedHandle<AuthConfig> ac;
|
||||
|
@ -129,31 +129,31 @@ AuthConfigFactory::createAuthConfig(const std::string& user, const std::string&
|
|||
return ac;
|
||||
}
|
||||
|
||||
AuthResolverHandle AuthConfigFactory::createHttpAuthResolver
|
||||
SharedHandle<AuthResolver> AuthConfigFactory::createHttpAuthResolver
|
||||
(const Option* op) const
|
||||
{
|
||||
AbstractAuthResolverHandle resolver;
|
||||
AbstractAuthResolver* resolver;
|
||||
if(op->getAsBool(PREF_NO_NETRC)) {
|
||||
resolver.reset(new DefaultAuthResolver());
|
||||
resolver = new DefaultAuthResolver();
|
||||
} else {
|
||||
NetrcAuthResolverHandle authResolver(new NetrcAuthResolver());
|
||||
NetrcAuthResolver* authResolver(new NetrcAuthResolver());
|
||||
authResolver->setNetrc(netrc_);
|
||||
authResolver->ignoreDefault();
|
||||
resolver = authResolver;
|
||||
}
|
||||
resolver->setUserDefinedAuthConfig
|
||||
(createAuthConfig(op->get(PREF_HTTP_USER), op->get(PREF_HTTP_PASSWD)));
|
||||
return resolver;
|
||||
return SharedHandle<AuthResolver>(resolver);
|
||||
}
|
||||
|
||||
AuthResolverHandle AuthConfigFactory::createFtpAuthResolver
|
||||
SharedHandle<AuthResolver> AuthConfigFactory::createFtpAuthResolver
|
||||
(const Option* op) const
|
||||
{
|
||||
AbstractAuthResolverHandle resolver;
|
||||
AbstractAuthResolver* resolver;
|
||||
if(op->getAsBool(PREF_NO_NETRC)) {
|
||||
resolver.reset(new DefaultAuthResolver());
|
||||
resolver = new DefaultAuthResolver();
|
||||
} else {
|
||||
NetrcAuthResolverHandle authResolver(new NetrcAuthResolver());
|
||||
NetrcAuthResolver* authResolver(new NetrcAuthResolver());
|
||||
authResolver->setNetrc(netrc_);
|
||||
resolver = authResolver;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ AuthResolverHandle AuthConfigFactory::createFtpAuthResolver
|
|||
SharedHandle<AuthConfig> defaultAuthConfig
|
||||
(new AuthConfig(AUTH_DEFAULT_USER, AUTH_DEFAULT_PASSWD));
|
||||
resolver->setDefaultAuthConfig(defaultAuthConfig);
|
||||
return resolver;
|
||||
return SharedHandle<AuthResolver>(resolver);
|
||||
}
|
||||
|
||||
void AuthConfigFactory::setNetrc(const SharedHandle<Netrc>& netrc)
|
||||
|
|
|
@ -55,12 +55,12 @@ class AuthResolver;
|
|||
class AuthConfigFactory {
|
||||
private:
|
||||
SharedHandle<Netrc> netrc_;
|
||||
|
||||
|
||||
SharedHandle<AuthConfig> createAuthConfig(const std::string& user,
|
||||
const std::string& password) const;
|
||||
|
||||
SharedHandle<AuthResolver> createHttpAuthResolver(const Option* op) const;
|
||||
|
||||
|
||||
SharedHandle<AuthResolver> createFtpAuthResolver(const Option* op) const;
|
||||
public:
|
||||
class BasicCred {
|
||||
|
@ -90,7 +90,6 @@ public:
|
|||
private:
|
||||
BasicCredSet basicCreds_;
|
||||
public:
|
||||
|
||||
AuthConfigFactory();
|
||||
|
||||
~AuthConfigFactory();
|
||||
|
@ -131,8 +130,6 @@ public:
|
|||
void updateBasicCred(const SharedHandle<BasicCred>& basicCred);
|
||||
};
|
||||
|
||||
typedef SharedHandle<AuthConfigFactory> AuthConfigFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_AUTH_CONFIG_FACTORY_H
|
||||
|
|
|
@ -36,9 +36,11 @@
|
|||
#define D_AUTH_RESOLVER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class AuthConfig;
|
||||
|
@ -50,8 +52,6 @@ public:
|
|||
virtual SharedHandle<AuthConfig> resolveAuthConfig(const std::string& hostname) = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<AuthResolver> AuthResolverHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_AUTH_RESOLVER_H
|
||||
|
|
|
@ -39,14 +39,12 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class BinaryStream {
|
||||
public:
|
||||
virtual ~BinaryStream() {}
|
||||
|
||||
|
||||
virtual void writeData(const unsigned char* data, size_t len,
|
||||
int64_t offset) = 0;
|
||||
|
||||
|
@ -61,8 +59,6 @@ public:
|
|||
virtual void allocate(int64_t offset, int64_t length) {}
|
||||
};
|
||||
|
||||
typedef SharedHandle<BinaryStream> BinaryStreamHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BINARY_STREAM_H
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "a2time.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -132,8 +131,6 @@ public:
|
|||
static const time_t DEFAULT_ANNOUNCE_INTERVAL = 120;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtAnnounce> BtAnnounceHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_ANNOUNCE_H
|
||||
|
|
|
@ -53,8 +53,6 @@ public:
|
|||
virtual void validate();
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtBitfieldMessageValidator> BtBitfieldMessageValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_BITFIELD_MESSAGE_VALIDATOR_H
|
||||
|
|
|
@ -52,8 +52,6 @@ public:
|
|||
DownloadEngine* e);
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtCheckIntegrityEntry> BtCheckIntegrityEntryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_FILE_ALLOCATION_ENTRY_H
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define D_BT_DEPENDENCY_H
|
||||
|
||||
#include "Dependency.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -56,8 +57,6 @@ public:
|
|||
virtual bool resolve();
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtDependency> BtDependencyHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_DEPENDENCY_H
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace aria2 {
|
|||
const char BtExtendedMessage::NAME[] = "extended";
|
||||
|
||||
BtExtendedMessage::BtExtendedMessage
|
||||
(const ExtensionMessageHandle& extensionMessage):
|
||||
(const SharedHandle<ExtensionMessage>& extensionMessage):
|
||||
SimpleBtMessage(ID, NAME),
|
||||
extensionMessage_(extensionMessage),
|
||||
msgLength_(0)
|
||||
|
|
|
@ -49,8 +49,6 @@ public:
|
|||
DownloadEngine* e);
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtFileAllocationEntry> BtFileAllocationEntryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_FILE_ALLOCATION_ENTRY_H
|
||||
|
|
|
@ -58,8 +58,6 @@ public:
|
|||
virtual void validate();
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtHandshakeMessageValidator> BtHandshakeMessageValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_HANDSHAKE_MESSAGE_VALIDATOR_H
|
||||
|
|
|
@ -69,8 +69,6 @@ public:
|
|||
virtual size_t countOutstandingRequest() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtInteractive> BtInteractiveHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_INTERACTIVE_H
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
class BtKeepAliveMessage;
|
||||
|
||||
typedef SharedHandle<BtKeepAliveMessage> BtKeepAliveMessageHandle;
|
||||
|
||||
class BtKeepAliveMessage : public SimpleBtMessage {
|
||||
private:
|
||||
static const size_t MESSAGE_LENGTH = 4;
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "BtAbortOutstandingRequestEvent.h"
|
||||
#include "BtCancelSendingPieceEvent.h"
|
||||
#include "BtChokingEvent.h"
|
||||
|
@ -84,8 +83,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtMessage> BtMessageHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_MESSAGE_H
|
||||
|
|
|
@ -89,8 +89,6 @@ public:
|
|||
virtual size_t countOutstandingUpload() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtMessageDispatcher> BtMessageDispatcherHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_MESSAGE_DISPATCHER_H
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
virtual SharedHandle<BtMessage> createChokeMessage() = 0;
|
||||
|
||||
virtual SharedHandle<BtMessage> createUnchokeMessage() = 0;
|
||||
|
||||
|
||||
virtual SharedHandle<BtMessage> createInterestedMessage() = 0;
|
||||
|
||||
virtual SharedHandle<BtMessage> createNotInterestedMessage() = 0;
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
virtual SharedHandle<BtMessage> createBitfieldMessage() = 0;
|
||||
|
||||
virtual SharedHandle<BtMessage> createKeepAliveMessage() = 0;
|
||||
|
||||
|
||||
virtual SharedHandle<BtMessage> createHaveAllMessage() = 0;
|
||||
|
||||
virtual SharedHandle<BtMessage> createHaveNoneMessage() = 0;
|
||||
|
@ -97,8 +97,6 @@ public:
|
|||
createBtExtendedMessage(const SharedHandle<ExtensionMessage>& msg) = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtMessageFactory> BtMessageFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_MESSAGE_FACTORY_H
|
||||
|
|
|
@ -54,8 +54,6 @@ public:
|
|||
virtual SharedHandle<BtMessage> receiveMessage() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtMessageReceiver> BtMessageReceiverHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_MESSAGE_RECEIVER_H
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class BtMessageValidator {
|
||||
|
@ -51,8 +49,6 @@ public:
|
|||
virtual void validate() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtMessageValidator> BtMessageValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_MESSAGE_VALIDATOR_H
|
||||
|
|
|
@ -281,7 +281,7 @@ void BtPieceMessage::onChokingEvent(const BtChokingEvent& event)
|
|||
begin_,
|
||||
blockLength_));
|
||||
if(getPeer()->isFastExtensionEnabled()) {
|
||||
BtMessageHandle rej =
|
||||
SharedHandle<BtMessage> rej =
|
||||
getBtMessageFactory()->createRejectMessage
|
||||
(index_, begin_, blockLength_);
|
||||
getBtMessageDispatcher()->addMessageToQueue(rej);
|
||||
|
@ -304,13 +304,13 @@ void BtPieceMessage::onCancelSendingPieceEvent
|
|||
begin_,
|
||||
blockLength_));
|
||||
if(getPeer()->isFastExtensionEnabled()) {
|
||||
BtMessageHandle rej =
|
||||
SharedHandle<BtMessage> rej =
|
||||
getBtMessageFactory()->createRejectMessage
|
||||
(index_, begin_, blockLength_);
|
||||
getBtMessageDispatcher()->addMessageToQueue(rej);
|
||||
}
|
||||
setInvalidate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BtPieceMessage::setDownloadContext
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
virtual void validate();
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtPieceMessageValidator> BtPieceMessageValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_PIECE_MESSAGE_VALIDATOR_H
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#define D_BT_PROGRESS_INFO_FILE_H
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -59,8 +59,6 @@ public:
|
|||
virtual void updateFilename() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtProgressInfoFile> BtProgressInfoFileHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_PROGRESS_INFO_FILE_H
|
||||
|
|
|
@ -87,8 +87,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtRequestFactory> BtRequestFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_REQUEST_FACTORY_H
|
||||
|
|
|
@ -63,13 +63,13 @@ void BtRequestMessage::doReceivedAction()
|
|||
(!getPeer()->amChoking() ||
|
||||
(getPeer()->amChoking() &&
|
||||
getPeer()->isInAmAllowedIndexSet(getIndex())))) {
|
||||
BtMessageHandle msg =
|
||||
SharedHandle<BtMessage> msg =
|
||||
getBtMessageFactory()->createPieceMessage
|
||||
(getIndex(), getBegin(), getLength());
|
||||
getBtMessageDispatcher()->addMessageToQueue(msg);
|
||||
} else {
|
||||
if(getPeer()->isFastExtensionEnabled()) {
|
||||
BtMessageHandle msg =
|
||||
SharedHandle<BtMessage> msg =
|
||||
getBtMessageFactory()->createRejectMessage
|
||||
(getIndex(), getBegin(), getLength());
|
||||
getBtMessageDispatcher()->addMessageToQueue(msg);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#define D_BT_RUNTIME_H
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -107,8 +106,6 @@ public:
|
|||
static const int DEFAULT_MIN_PEERS = 40;
|
||||
};
|
||||
|
||||
typedef SharedHandle<BtRuntime> BtRuntimeHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BT_RUNTIME_H
|
||||
|
|
|
@ -67,8 +67,6 @@ public:
|
|||
std::string getString() const;
|
||||
};
|
||||
|
||||
typedef SharedHandle<ByteArrayDiskWriter> ByteArrayDiskWriterHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BYTE_ARRAY_DISK_WRITER_H
|
||||
|
|
|
@ -43,8 +43,6 @@ namespace aria2 {
|
|||
typedef AnonDiskWriterFactory<ByteArrayDiskWriter>
|
||||
ByteArrayDiskWriterFactory;
|
||||
|
||||
typedef SharedHandle<ByteArrayDiskWriterFactory> ByteArrayDiskWriterFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_BYTE_ARRAY_DISK_WRITER_FACTORY_H
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
#define D_CHECK_INTEGRITY_ENTRY_H
|
||||
|
||||
#include "RequestGroupEntry.h"
|
||||
#include "ProgressAwareEntry.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "ProgressAwareEntry.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class IteratableValidator;
|
||||
|
|
|
@ -83,8 +83,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<ConsoleStatCalc> ConsoleStatCalcHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_CONSOLE_STAT_CALC_H
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "Logger.h"
|
||||
#include "RecoverableException.h"
|
||||
#include "util.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "SimpleRandomizer.h"
|
||||
#include "fmt.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "DHTMessageReceiver.h"
|
||||
#include "DHTTaskQueue.h"
|
||||
#include "DHTMessage.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "message.h"
|
||||
#include "RequestGroupMan.h"
|
||||
#include "Logger.h"
|
||||
|
@ -60,7 +60,7 @@ DHTInteractionCommand::~DHTInteractionCommand()
|
|||
disableReadCheckSocket(readCheckSocket_);
|
||||
}
|
||||
|
||||
void DHTInteractionCommand::setReadCheckSocket(const SocketHandle& socket)
|
||||
void DHTInteractionCommand::setReadCheckSocket(const SharedHandle<SocketCore>& socket)
|
||||
{
|
||||
readCheckSocket_ = socket;
|
||||
if(socket) {
|
||||
|
@ -68,7 +68,7 @@ void DHTInteractionCommand::setReadCheckSocket(const SocketHandle& socket)
|
|||
}
|
||||
}
|
||||
|
||||
void DHTInteractionCommand::disableReadCheckSocket(const SocketHandle& socket)
|
||||
void DHTInteractionCommand::disableReadCheckSocket(const SharedHandle<SocketCore>& socket)
|
||||
{
|
||||
if(socket) {
|
||||
e_->deleteSocketForReadCheck(socket, this);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
AuthConfigHandle DefaultAuthResolver::resolveAuthConfig
|
||||
SharedHandle<AuthConfig> DefaultAuthResolver::resolveAuthConfig
|
||||
(const std::string& hostname)
|
||||
{
|
||||
if(!getUserDefinedAuthConfig()) {
|
||||
|
|
|
@ -297,22 +297,24 @@ void DefaultBtAnnounce::shuffleAnnounce() {
|
|||
announceList_.shuffle();
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setRandomizer(const RandomizerHandle& randomizer)
|
||||
void DefaultBtAnnounce::setRandomizer
|
||||
(const SharedHandle<Randomizer>& randomizer)
|
||||
{
|
||||
randomizer_ = randomizer;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setBtRuntime(const BtRuntimeHandle& btRuntime)
|
||||
void DefaultBtAnnounce::setBtRuntime(const SharedHandle<BtRuntime>& btRuntime)
|
||||
{
|
||||
btRuntime_ = btRuntime;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setPieceStorage(const PieceStorageHandle& pieceStorage)
|
||||
void DefaultBtAnnounce::setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage)
|
||||
{
|
||||
pieceStorage_ = pieceStorage;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setPeerStorage(const PeerStorageHandle& peerStorage)
|
||||
void DefaultBtAnnounce::setPeerStorage
|
||||
(const SharedHandle<PeerStorage>& peerStorage)
|
||||
{
|
||||
peerStorage_ = peerStorage;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ void DefaultBtInteractive::initiateHandshake() {
|
|||
dispatcher_->sendMessages();
|
||||
}
|
||||
|
||||
BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
||||
SharedHandle<BtMessage> DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
||||
SharedHandle<BtHandshakeMessage> message =
|
||||
btMessageReceiver_->receiveHandshake(quickReply);
|
||||
if(!message) {
|
||||
|
@ -155,7 +155,7 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
|
|||
return message;
|
||||
}
|
||||
|
||||
BtMessageHandle DefaultBtInteractive::receiveAndSendHandshake() {
|
||||
SharedHandle<BtMessage> DefaultBtInteractive::receiveAndSendHandshake() {
|
||||
return receiveHandshake(true);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ void DefaultBtInteractive::addPortMessageToQueue()
|
|||
|
||||
void DefaultBtInteractive::addHandshakeExtendedMessageToQueue()
|
||||
{
|
||||
HandshakeExtensionMessageHandle m(new HandshakeExtensionMessage());
|
||||
SharedHandle<HandshakeExtensionMessage> m(new HandshakeExtensionMessage());
|
||||
m->setClientVersion("aria2/" PACKAGE_VERSION);
|
||||
m->setTCPPort(tcpPort_);
|
||||
m->setExtensions(extensionMessageRegistry_->getExtensions());
|
||||
|
@ -279,7 +279,7 @@ size_t DefaultBtInteractive::receiveMessages() {
|
|||
downloadContext_->getOwnerRequestGroup()->doesDownloadSpeedExceed()) {
|
||||
break;
|
||||
}
|
||||
BtMessageHandle message = btMessageReceiver_->receiveMessage();
|
||||
SharedHandle<BtMessage> message = btMessageReceiver_->receiveMessage();
|
||||
if(!message) {
|
||||
break;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ void DefaultBtInteractive::addPeerExchangeMessage()
|
|||
{
|
||||
if(pexTimer_.
|
||||
difference(global::wallclock()) >= UTPexExtensionMessage::DEFAULT_INTERVAL) {
|
||||
UTPexExtensionMessageHandle m
|
||||
SharedHandle<UTPexExtensionMessage> m
|
||||
(new UTPexExtensionMessage(peer_->getExtensionMessageID
|
||||
(ExtensionMessageRegistry::UT_PEX)));
|
||||
|
||||
|
@ -496,7 +496,7 @@ void DefaultBtInteractive::addPeerExchangeMessage()
|
|||
}
|
||||
}
|
||||
|
||||
BtMessageHandle msg = messageFactory_->createBtExtendedMessage(m);
|
||||
SharedHandle<BtMessage> msg = messageFactory_->createBtExtendedMessage(m);
|
||||
dispatcher_->addMessageToQueue(msg);
|
||||
pexTimer_ = global::wallclock();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ DefaultBtMessageDispatcher::~DefaultBtMessageDispatcher()
|
|||
}
|
||||
|
||||
void DefaultBtMessageDispatcher::addMessageToQueue
|
||||
(const BtMessageHandle& btMessage)
|
||||
(const SharedHandle<BtMessage>& btMessage)
|
||||
{
|
||||
btMessage->onQueued();
|
||||
messageQueue_.push_back(btMessage);
|
||||
|
@ -90,7 +90,7 @@ void DefaultBtMessageDispatcher::addMessageToQueue
|
|||
void DefaultBtMessageDispatcher::sendMessages() {
|
||||
std::vector<SharedHandle<BtMessage> > tempQueue;
|
||||
while(!messageQueue_.empty()) {
|
||||
BtMessageHandle msg = messageQueue_.front();
|
||||
SharedHandle<BtMessage> msg = messageQueue_.front();
|
||||
messageQueue_.pop_front();
|
||||
if(msg->isUploading() && !msg->isSendingInProgress()) {
|
||||
if(requestGroupMan_->doesOverallUploadSpeedExceed() ||
|
||||
|
|
|
@ -165,7 +165,7 @@ DefaultBtMessageFactory::createBtMessage
|
|||
case BtPieceMessage::ID: {
|
||||
BtPieceMessage* m = BtPieceMessage::create(data, dataLength);
|
||||
if(!metadataGetMode_) {
|
||||
BtMessageValidatorHandle validator
|
||||
SharedHandle<BtMessageValidator> validator
|
||||
(new BtPieceMessageValidator
|
||||
(m,
|
||||
downloadContext_->getNumPieces(),
|
||||
|
@ -264,7 +264,7 @@ DefaultBtMessageFactory::createHandshakeMessage
|
|||
{
|
||||
SharedHandle<BtHandshakeMessage> msg =
|
||||
BtHandshakeMessage::create(data, dataLength);
|
||||
BtMessageValidatorHandle validator
|
||||
SharedHandle<BtMessageValidator> validator
|
||||
(new BtHandshakeMessageValidator
|
||||
(msg.get(), bittorrent::getInfoHash(downloadContext_)));
|
||||
msg->setBtMessageValidator(validator);
|
||||
|
@ -416,7 +416,7 @@ DefaultBtMessageFactory::createPortMessage(uint16_t port)
|
|||
|
||||
SharedHandle<BtMessage>
|
||||
DefaultBtMessageFactory::createBtExtendedMessage
|
||||
(const ExtensionMessageHandle& msg)
|
||||
(const SharedHandle<ExtensionMessage>& msg)
|
||||
{
|
||||
BtExtendedMessage* m(new BtExtendedMessage(msg));
|
||||
setCommonProperty(m);
|
||||
|
|
|
@ -114,13 +114,13 @@ void DefaultBtMessageReceiver::sendHandshake() {
|
|||
dispatcher_->sendMessages();
|
||||
}
|
||||
|
||||
BtMessageHandle DefaultBtMessageReceiver::receiveMessage() {
|
||||
SharedHandle<BtMessage> DefaultBtMessageReceiver::receiveMessage() {
|
||||
size_t dataLength = 0;
|
||||
// Give 0 to PeerConnection::receiveMessage() to prevent memcpy.
|
||||
if(!peerConnection_->receiveMessage(0, dataLength)) {
|
||||
return SharedHandle<BtMessage>();
|
||||
}
|
||||
BtMessageHandle msg =
|
||||
SharedHandle<BtMessage> msg =
|
||||
messageFactory_->createBtMessage(peerConnection_->getMsgPayloadBuffer(),
|
||||
dataLength);
|
||||
msg->validate();
|
||||
|
|
|
@ -75,7 +75,7 @@ std::string createFilename
|
|||
|
||||
DefaultBtProgressInfoFile::DefaultBtProgressInfoFile
|
||||
(const SharedHandle<DownloadContext>& dctx,
|
||||
const PieceStorageHandle& pieceStorage,
|
||||
const SharedHandle<PieceStorage>& pieceStorage,
|
||||
const Option* option)
|
||||
: dctx_(dctx),
|
||||
pieceStorage_(pieceStorage),
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define D_DEFAULT_BT_PROGRESS_INFO_FILE_H
|
||||
|
||||
#include "BtProgressInfoFile.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -65,7 +66,7 @@ public:
|
|||
virtual ~DefaultBtProgressInfoFile();
|
||||
|
||||
virtual std::string getFilename() { return filename_; }
|
||||
|
||||
|
||||
virtual bool exists();
|
||||
|
||||
virtual void save();
|
||||
|
|
|
@ -72,13 +72,13 @@ DefaultExtensionMessageFactory::DefaultExtensionMessageFactory
|
|||
|
||||
DefaultExtensionMessageFactory::~DefaultExtensionMessageFactory() {}
|
||||
|
||||
ExtensionMessageHandle
|
||||
SharedHandle<ExtensionMessage>
|
||||
DefaultExtensionMessageFactory::createMessage(const unsigned char* data, size_t length)
|
||||
{
|
||||
uint8_t extensionMessageID = *data;
|
||||
if(extensionMessageID == 0) {
|
||||
// handshake
|
||||
HandshakeExtensionMessageHandle m =
|
||||
SharedHandle<HandshakeExtensionMessage> m =
|
||||
HandshakeExtensionMessage::create(data, length);
|
||||
m->setPeer(peer_);
|
||||
m->setDownloadContext(dctx_);
|
||||
|
@ -92,7 +92,7 @@ DefaultExtensionMessageFactory::createMessage(const unsigned char* data, size_t
|
|||
}
|
||||
if(strcmp(extensionName, "ut_pex") == 0) {
|
||||
// uTorrent compatible Peer-Exchange
|
||||
UTPexExtensionMessageHandle m =
|
||||
SharedHandle<UTPexExtensionMessage> m =
|
||||
UTPexExtensionMessage::create(data, length);
|
||||
m->setPeerStorage(peerStorage_);
|
||||
return m;
|
||||
|
|
|
@ -613,25 +613,25 @@ void DefaultPieceStorage::initStorage()
|
|||
{
|
||||
if(downloadContext_->getFileEntries().size() == 1) {
|
||||
A2_LOG_DEBUG("Instantiating DirectDiskAdaptor");
|
||||
DirectDiskAdaptorHandle directDiskAdaptor(new DirectDiskAdaptor());
|
||||
DirectDiskAdaptor* directDiskAdaptor(new DirectDiskAdaptor());
|
||||
directDiskAdaptor->setTotalLength(downloadContext_->getTotalLength());
|
||||
directDiskAdaptor->setFileEntries
|
||||
(downloadContext_->getFileEntries().begin(),
|
||||
downloadContext_->getFileEntries().end());
|
||||
|
||||
DiskWriterHandle writer =
|
||||
SharedHandle<DiskWriter> writer =
|
||||
diskWriterFactory_->newDiskWriter(directDiskAdaptor->getFilePath());
|
||||
directDiskAdaptor->setDiskWriter(writer);
|
||||
diskAdaptor_ = directDiskAdaptor;
|
||||
diskAdaptor_.reset(directDiskAdaptor);
|
||||
} else {
|
||||
A2_LOG_DEBUG("Instantiating MultiDiskAdaptor");
|
||||
MultiDiskAdaptorHandle multiDiskAdaptor(new MultiDiskAdaptor());
|
||||
MultiDiskAdaptor* multiDiskAdaptor(new MultiDiskAdaptor());
|
||||
multiDiskAdaptor->setFileEntries(downloadContext_->getFileEntries().begin(),
|
||||
downloadContext_->getFileEntries().end());
|
||||
multiDiskAdaptor->setPieceLength(downloadContext_->getPieceLength());
|
||||
multiDiskAdaptor->setMaxOpenFiles
|
||||
(option_->getAsInt(PREF_BT_MAX_OPEN_FILES));
|
||||
diskAdaptor_ = multiDiskAdaptor;
|
||||
diskAdaptor_.reset(multiDiskAdaptor);
|
||||
}
|
||||
if(option_->get(PREF_FILE_ALLOCATION) == V_FALLOC) {
|
||||
diskAdaptor_->setFileAllocationMethod(DiskAdaptor::FILE_ALLOC_FALLOC);
|
||||
|
@ -657,7 +657,7 @@ const unsigned char* DefaultPieceStorage::getBitfield()
|
|||
return bitfieldMan_->getBitfield();
|
||||
}
|
||||
|
||||
DiskAdaptorHandle DefaultPieceStorage::getDiskAdaptor() {
|
||||
SharedHandle<DiskAdaptor> DefaultPieceStorage::getDiskAdaptor() {
|
||||
return diskAdaptor_;
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ void DefaultPieceStorage::markPiecesDone(int64_t length)
|
|||
if(r > 0) {
|
||||
SharedHandle<Piece> p
|
||||
(new Piece(numPiece, bitfieldMan_->getBlockLength(numPiece)));
|
||||
|
||||
|
||||
for(size_t i = 0; i < r; ++i) {
|
||||
p->completeBlock(i);
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ void DefaultPieceStorage::getInFlightPieces
|
|||
}
|
||||
|
||||
void DefaultPieceStorage::setDiskWriterFactory
|
||||
(const DiskWriterFactoryHandle& diskWriterFactory)
|
||||
(const SharedHandle<DiskWriterFactory>& diskWriterFactory)
|
||||
{
|
||||
diskWriterFactory_ = diskWriterFactory;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#define D_DEPENDENCY_H
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -47,8 +46,6 @@ public:
|
|||
virtual bool resolve() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<Dependency> DependencyHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DEPENDENCY_H
|
||||
|
|
|
@ -46,8 +46,6 @@ public:
|
|||
virtual size_t utime(const Time& actime, const Time& modtime);
|
||||
};
|
||||
|
||||
typedef SharedHandle<DirectDiskAdaptor> DirectDiskAdaptorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DIRECT_DISK_ADAPTOR_H
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "TimeA2.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -118,8 +119,6 @@ private:
|
|||
FileAllocationMethod fileAllocationMethod_;
|
||||
};
|
||||
|
||||
typedef SharedHandle<DiskAdaptor> DiskAdaptorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DISK_ADAPTOR_H
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
* Opens file. If the file exists, then it is truncated to 0 length.
|
||||
*/
|
||||
virtual void initAndOpenFile(int64_t totalLength = 0) = 0;
|
||||
|
||||
|
||||
virtual void openFile(int64_t totalLength = 0) = 0;
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,6 @@ public:
|
|||
virtual void enableMmap() {}
|
||||
};
|
||||
|
||||
typedef SharedHandle<DiskWriter> DiskWriterHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DISK_WRITER_H
|
||||
|
|
|
@ -52,8 +52,6 @@ public:
|
|||
virtual SharedHandle<DiskWriter> newDiskWriter(const std::string& filename)=0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<DiskWriterFactory> DiskWriterFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DISK_WRITER_FACTORY_H
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "DownloadContext.h"
|
||||
#include "Option.h"
|
||||
#include "util.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "fmt.h"
|
||||
|
@ -82,7 +82,7 @@ DownloadCommand::DownloadCommand
|
|||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s,
|
||||
const SharedHandle<SocketCore>& s,
|
||||
const SharedHandle<SocketRecvBuffer>& socketRecvBuffer)
|
||||
: AbstractCommand(cuid, req, fileEntry, requestGroup, e, s, socketRecvBuffer),
|
||||
startupIdleTime_(10),
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "StatCalc.h"
|
||||
#include "LogFactory.h"
|
||||
#include "Logger.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "util.h"
|
||||
#include "a2functional.h"
|
||||
#include "DlAbortEx.h"
|
||||
|
@ -176,28 +176,28 @@ void DownloadEngine::waitData()
|
|||
eventPoll_->poll(tv);
|
||||
}
|
||||
|
||||
bool DownloadEngine::addSocketForReadCheck(const SocketHandle& socket,
|
||||
bool DownloadEngine::addSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
||||
Command* command)
|
||||
{
|
||||
return eventPoll_->addEvents(socket->getSockfd(), command,
|
||||
EventPoll::EVENT_READ);
|
||||
}
|
||||
|
||||
bool DownloadEngine::deleteSocketForReadCheck(const SocketHandle& socket,
|
||||
bool DownloadEngine::deleteSocketForReadCheck(const SharedHandle<SocketCore>& socket,
|
||||
Command* command)
|
||||
{
|
||||
return eventPoll_->deleteEvents(socket->getSockfd(), command,
|
||||
EventPoll::EVENT_READ);
|
||||
}
|
||||
|
||||
bool DownloadEngine::addSocketForWriteCheck(const SocketHandle& socket,
|
||||
bool DownloadEngine::addSocketForWriteCheck(const SharedHandle<SocketCore>& socket,
|
||||
Command* command)
|
||||
{
|
||||
return eventPoll_->addEvents(socket->getSockfd(), command,
|
||||
EventPoll::EVENT_WRITE);
|
||||
}
|
||||
|
||||
bool DownloadEngine::deleteSocketForWriteCheck(const SocketHandle& socket,
|
||||
bool DownloadEngine::deleteSocketForWriteCheck(const SharedHandle<SocketCore>& socket,
|
||||
Command* command)
|
||||
{
|
||||
return eventPoll_->deleteEvents(socket->getSockfd(), command,
|
||||
|
@ -249,7 +249,7 @@ void DownloadEngine::requestForceHalt()
|
|||
requestGroupMan_->forceHalt();
|
||||
}
|
||||
|
||||
void DownloadEngine::setStatCalc(const StatCalcHandle& statCalc)
|
||||
void DownloadEngine::setStatCalc(const SharedHandle<StatCalc>& statCalc)
|
||||
{
|
||||
statCalc_ = statCalc;
|
||||
}
|
||||
|
|
|
@ -341,8 +341,6 @@ public:
|
|||
#endif // HAVE_ARES_ADDR_NODE
|
||||
};
|
||||
|
||||
typedef SharedHandle<DownloadEngine> DownloadEngineHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DOWNLOAD_ENGINE_H
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace aria2 {
|
|||
|
||||
DownloadEngineFactory::DownloadEngineFactory() {}
|
||||
|
||||
DownloadEngineHandle
|
||||
SharedHandle<DownloadEngine>
|
||||
DownloadEngineFactory::newDownloadEngine
|
||||
(Option* op, const std::vector<SharedHandle<RequestGroup> >& requestGroups)
|
||||
{
|
||||
|
@ -130,10 +130,10 @@ DownloadEngineFactory::newDownloadEngine
|
|||
} else {
|
||||
abort();
|
||||
}
|
||||
DownloadEngineHandle e(new DownloadEngine(eventPoll));
|
||||
SharedHandle<DownloadEngine> e(new DownloadEngine(eventPoll));
|
||||
e->setOption(op);
|
||||
|
||||
RequestGroupManHandle
|
||||
SharedHandle<RequestGroupMan>
|
||||
requestGroupMan(new RequestGroupMan(requestGroups, MAX_CONCURRENT_DOWNLOADS,
|
||||
op));
|
||||
e->setRequestGroupMan(requestGroupMan);
|
||||
|
|
|
@ -55,7 +55,7 @@ class MetadataInfo;
|
|||
struct DownloadResult
|
||||
{
|
||||
a2_gid_t gid;
|
||||
|
||||
|
||||
std::vector<SharedHandle<FileEntry> > fileEntries;
|
||||
|
||||
bool inMemoryDownload;
|
||||
|
@ -103,8 +103,6 @@ struct DownloadResult
|
|||
DownloadResult& operator=(const DownloadResult& c);
|
||||
};
|
||||
|
||||
typedef SharedHandle<DownloadResult> DownloadResultHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_DOWNLOAD_RESULT_H
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
class ExtensionMessage {
|
||||
public:
|
||||
|
@ -57,8 +55,6 @@ public:
|
|||
virtual void doReceivedAction() = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<ExtensionMessage> ExtensionMessageHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_EXTENSION_MESSAGE_H
|
||||
|
|
|
@ -50,8 +50,6 @@ public:
|
|||
createMessage(const unsigned char* data, size_t length) = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<ExtensionMessageFactory> ExtensionMessageFactoryHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_EXTENSION_MESSAGE_FACTORY_H
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
#define D_FILE_ALLOCATION_ENTRY_H
|
||||
|
||||
#include "RequestGroupEntry.h"
|
||||
#include "ProgressAwareEntry.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "ProgressAwareEntry.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class FileAllocationIterator;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "AuthConfig.h"
|
||||
#include "DlRetryEx.h"
|
||||
#include "DlAbortEx.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "A2STR.h"
|
||||
#include "fmt.h"
|
||||
#include "AuthConfig.h"
|
||||
|
@ -62,7 +62,7 @@ namespace aria2 {
|
|||
|
||||
FtpConnection::FtpConnection
|
||||
(cuid_t cuid,
|
||||
const SocketHandle& socket,
|
||||
const SharedHandle<SocketCore>& socket,
|
||||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<AuthConfig>& authConfig,
|
||||
const Option* op)
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
/* copyright --> */
|
||||
#include "FtpDownloadCommand.h"
|
||||
#include "Request.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "Segment.h"
|
||||
#include "DownloadEngine.h"
|
||||
#include "RequestGroup.h"
|
||||
|
@ -55,8 +55,8 @@ FtpDownloadCommand::FtpDownloadCommand
|
|||
RequestGroup* requestGroup,
|
||||
const SharedHandle<FtpConnection>& ftpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& dataSocket,
|
||||
const SocketHandle& ctrlSocket)
|
||||
const SharedHandle<SocketCore>& dataSocket,
|
||||
const SharedHandle<SocketCore>& ctrlSocket)
|
||||
:DownloadCommand(cuid, req, fileEntry, requestGroup, e, dataSocket,
|
||||
SharedHandle<SocketRecvBuffer>
|
||||
(new SocketRecvBuffer(dataSocket))),
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "HttpConnection.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "util.h"
|
||||
#include "AuthConfigFactory.h"
|
||||
#include "AuthConfig.h"
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include "DefaultBtProgressInfoFile.h"
|
||||
#include "RequestGroupMan.h"
|
||||
#include "DownloadFailureException.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "fmt.h"
|
||||
#include "DiskAdaptor.h"
|
||||
#include "SegmentMan.h"
|
||||
|
@ -86,7 +86,7 @@ FtpNegotiationCommand::FtpNegotiationCommand
|
|||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& socket,
|
||||
const SharedHandle<SocketCore>& socket,
|
||||
Seq seq,
|
||||
const std::string& baseWorkingDir):
|
||||
AbstractCommand(cuid, req, fileEntry, requestGroup, e, socket),
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "FtpTunnelRequestCommand.h"
|
||||
#include "FtpTunnelResponseCommand.h"
|
||||
#include "Request.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "DownloadContext.h"
|
||||
#include "SocketRecvBuffer.h"
|
||||
|
||||
|
@ -48,7 +48,7 @@ FtpTunnelRequestCommand::FtpTunnelRequestCommand
|
|||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SharedHandle<Request>& proxyRequest,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:
|
||||
AbstractProxyRequestCommand(cuid, req, fileEntry, requestGroup, e,
|
||||
proxyRequest, s)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "HttpConnection.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "Segment.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "SocketRecvBuffer.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -48,9 +48,9 @@ FtpTunnelResponseCommand::FtpTunnelResponseCommand
|
|||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:AbstractProxyResponseCommand(cuid, req, fileEntry, requestGroup,
|
||||
httpConnection,e, s)
|
||||
{}
|
||||
|
|
|
@ -164,7 +164,7 @@ uint8_t HandshakeExtensionMessage::getExtensionMessageID(int key) const
|
|||
return extreg_.getExtensionMessageID(key);
|
||||
}
|
||||
|
||||
HandshakeExtensionMessageHandle
|
||||
SharedHandle<HandshakeExtensionMessage>
|
||||
HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
|
||||
{
|
||||
if(length < 1) {
|
||||
|
@ -172,7 +172,7 @@ HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
|
|||
(fmt(MSG_TOO_SMALL_PAYLOAD_SIZE,
|
||||
EXTENSION_NAME, static_cast<unsigned long>(length)));
|
||||
}
|
||||
HandshakeExtensionMessageHandle msg(new HandshakeExtensionMessage());
|
||||
SharedHandle<HandshakeExtensionMessage> msg(new HandshakeExtensionMessage());
|
||||
A2_LOG_DEBUG(fmt("Creating HandshakeExtensionMessage from %s",
|
||||
util::percentEncode(data, length).c_str()));
|
||||
SharedHandle<ValueBase> decoded = bencode2::decode(data+1, length - 1);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "BtConstants.h"
|
||||
#include "ExtensionMessageRegistry.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -69,7 +70,7 @@ public:
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual const char* getExtensionName() const
|
||||
{
|
||||
return EXTENSION_NAME;
|
||||
|
@ -128,8 +129,6 @@ public:
|
|||
create(const unsigned char* data, size_t dataLength);
|
||||
};
|
||||
|
||||
typedef SharedHandle<HandshakeExtensionMessage> HandshakeExtensionMessageHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_HANDSHAKE_EXTENSION_MESSAGE_H
|
||||
|
|
|
@ -58,7 +58,7 @@ void HaveEraseCommand::process()
|
|||
size_t numLoop =
|
||||
getDownloadEngine()->getRequestGroupMan()->countRequestGroup();
|
||||
for(size_t i = 0; i < numLoop; ++i) {
|
||||
PieceStorageHandle ps =
|
||||
SharedHandle<PieceStorage> ps =
|
||||
getDownloadEngine()->getRequestGroupMan()->getRequestGroup(i)->
|
||||
getPieceStorage();
|
||||
if(ps) {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "HttpHeaderProcessor.h"
|
||||
#include "HttpHeader.h"
|
||||
#include "Logger.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "Option.h"
|
||||
#include "CookieStorage.h"
|
||||
#include "AuthConfigFactory.h"
|
||||
|
@ -71,7 +71,7 @@ HttpRequestEntry::~HttpRequestEntry() {}
|
|||
|
||||
HttpConnection::HttpConnection
|
||||
(cuid_t cuid,
|
||||
const SocketHandle& socket,
|
||||
const SharedHandle<SocketCore>& socket,
|
||||
const SharedHandle<SocketRecvBuffer>& socketRecvBuffer)
|
||||
: cuid_(cuid),
|
||||
socket_(socket),
|
||||
|
@ -129,7 +129,7 @@ SharedHandle<HttpResponse> HttpConnection::receiveResponse()
|
|||
if(outstandingHttpRequests_.empty()) {
|
||||
throw DL_ABORT_EX(EX_NO_HTTP_REQUEST_ENTRY_FOUND);
|
||||
}
|
||||
HttpRequestEntryHandle entry = outstandingHttpRequests_.front();
|
||||
SharedHandle<HttpRequestEntry> entry = outstandingHttpRequests_.front();
|
||||
const SharedHandle<HttpHeaderProcessor>& proc =
|
||||
entry->getHttpHeaderProcessor();
|
||||
if(socketRecvBuffer_->bufferEmpty()) {
|
||||
|
|
|
@ -74,8 +74,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<HttpRequestEntry> HttpRequestEntryHandle;
|
||||
typedef std::deque<HttpRequestEntryHandle> HttpRequestEntries;
|
||||
typedef std::deque<SharedHandle<HttpRequestEntry> > HttpRequestEntries;
|
||||
|
||||
class HttpConnection {
|
||||
private:
|
||||
|
@ -114,10 +113,10 @@ public:
|
|||
* object which contains response header and HttpRequestHandle object
|
||||
* for this response.
|
||||
* If a response is not fully received, received header is buffured
|
||||
* in this object and returns 0.
|
||||
* in this object and returns 0.
|
||||
* You should continue to call this method until whole response header is
|
||||
* received and this method returns non-null HttpResponseHandle object.
|
||||
*
|
||||
*
|
||||
* @return HttpResponse or 0 if whole response header is not received
|
||||
*/
|
||||
SharedHandle<HttpResponse> receiveResponse();
|
||||
|
@ -136,8 +135,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<HttpConnection> HttpConnectionHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_HTTP_CONNECTION_H
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "HttpConnection.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "Segment.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "prefs.h"
|
||||
#include "Option.h"
|
||||
#include "HttpResponse.h"
|
||||
|
@ -61,9 +61,9 @@ HttpDownloadCommand::HttpDownloadCommand
|
|||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const SharedHandle<HttpResponse>& httpResponse,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& socket)
|
||||
const SharedHandle<SocketCore>& socket)
|
||||
: DownloadCommand(cuid, req, fileEntry, requestGroup, e, socket,
|
||||
httpConnection->getSocketRecvBuffer()),
|
||||
httpResponse_(httpResponse),
|
||||
|
|
|
@ -85,7 +85,7 @@ HttpHeader::equalRange(int hdKey) const
|
|||
return table_.equal_range(hdKey);
|
||||
}
|
||||
|
||||
RangeHandle HttpHeader::getRange() const
|
||||
SharedHandle<Range> HttpHeader::getRange() const
|
||||
{
|
||||
const std::string& rangeStr = find(CONTENT_RANGE);
|
||||
if(rangeStr.empty()) {
|
||||
|
|
|
@ -162,8 +162,6 @@ public:
|
|||
|
||||
int idInterestingHeader(const char* hdName);
|
||||
|
||||
typedef SharedHandle<HttpHeader> HttpHeaderHandle;
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // D_HTTP_HEADER_H
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "Option.h"
|
||||
#include "Logger.h"
|
||||
#include "LogFactory.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "A2STR.h"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "HttpProxyRequestCommand.h"
|
||||
#include "HttpProxyResponseCommand.h"
|
||||
#include "Request.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "SocketRecvBuffer.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -47,7 +47,7 @@ HttpProxyRequestCommand::HttpProxyRequestCommand
|
|||
RequestGroup* requestGroup,
|
||||
DownloadEngine* e,
|
||||
const SharedHandle<Request>& proxyRequest,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:
|
||||
AbstractProxyRequestCommand(cuid, req, fileEntry, requestGroup, e,
|
||||
proxyRequest, s)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "HttpConnection.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "Segment.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "SocketRecvBuffer.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -48,9 +48,9 @@ HttpProxyResponseCommand::HttpProxyResponseCommand
|
|||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
:AbstractProxyResponseCommand(cuid, req, fileEntry, requestGroup,
|
||||
httpConnection, e, s)
|
||||
{}
|
||||
|
|
|
@ -101,7 +101,7 @@ int64_t HttpRequest::getEndByte() const
|
|||
}
|
||||
}
|
||||
|
||||
RangeHandle HttpRequest::getRange() const
|
||||
SharedHandle<Range> HttpRequest::getRange() const
|
||||
{
|
||||
// content-length is always 0
|
||||
if(!segment_) {
|
||||
|
@ -112,7 +112,7 @@ RangeHandle HttpRequest::getRange() const
|
|||
}
|
||||
}
|
||||
|
||||
bool HttpRequest::isRangeSatisfied(const RangeHandle& range) const
|
||||
bool HttpRequest::isRangeSatisfied(const SharedHandle<Range>& range) const
|
||||
{
|
||||
if(!segment_) {
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "SegmentMan.h"
|
||||
#include "Segment.h"
|
||||
#include "Option.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "prefs.h"
|
||||
#include "a2functional.h"
|
||||
#include "util.h"
|
||||
|
@ -67,9 +67,9 @@ HttpRequestCommand::HttpRequestCommand
|
|||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
: AbstractCommand(cuid, req, fileEntry, requestGroup, e, s,
|
||||
httpConnection->getSocketRecvBuffer()),
|
||||
httpConnection_(httpConnection)
|
||||
|
|
|
@ -96,7 +96,7 @@ void HttpResponse::validateResponse() const
|
|||
} else if(statusCode == 200 || statusCode == 206) {
|
||||
if(!httpHeader_->defined(HttpHeader::TRANSFER_ENCODING)) {
|
||||
// compare the received range against the requested range
|
||||
RangeHandle responseRange = httpHeader_->getRange();
|
||||
SharedHandle<Range> responseRange = httpHeader_->getRange();
|
||||
if(!httpRequest_->isRangeSatisfied(responseRange)) {
|
||||
throw DL_ABORT_EX2
|
||||
(fmt(EX_INVALID_RANGE_HEADER,
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "File.h"
|
||||
#include "Option.h"
|
||||
#include "Logger.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "fmt.h"
|
||||
|
@ -137,9 +137,9 @@ HttpResponseCommand::HttpResponseCommand
|
|||
const SharedHandle<Request>& req,
|
||||
const SharedHandle<FileEntry>& fileEntry,
|
||||
RequestGroup* requestGroup,
|
||||
const HttpConnectionHandle& httpConnection,
|
||||
const SharedHandle<HttpConnection>& httpConnection,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
: AbstractCommand(cuid, req, fileEntry, requestGroup, e, s,
|
||||
httpConnection->getSocketRecvBuffer()),
|
||||
httpConnection_(httpConnection)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "DlAbortEx.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "Logger.h"
|
||||
#include "LogFactory.h"
|
||||
#include "Peer.h"
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace aria2 {
|
|||
|
||||
IteratableChecksumValidator::IteratableChecksumValidator
|
||||
(const SharedHandle<DownloadContext>& dctx,
|
||||
const PieceStorageHandle& pieceStorage)
|
||||
const SharedHandle<PieceStorage>& pieceStorage)
|
||||
: dctx_(dctx),
|
||||
pieceStorage_(pieceStorage),
|
||||
currentOffset_(0)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define D_ITERATABLE_CHECKSUM_VALIDATOR_H
|
||||
|
||||
#include "IteratableValidator.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -73,8 +74,6 @@ public:
|
|||
virtual int64_t getTotalLength() const;
|
||||
};
|
||||
|
||||
typedef SharedHandle<IteratableChecksumValidator> IteratableChecksumValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_ITERATABLE_CHECKSUM_VALIDATOR_H
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace aria2 {
|
|||
|
||||
IteratableChunkChecksumValidator::IteratableChunkChecksumValidator
|
||||
(const SharedHandle<DownloadContext>& dctx,
|
||||
const PieceStorageHandle& pieceStorage)
|
||||
const SharedHandle<PieceStorage>& pieceStorage)
|
||||
: dctx_(dctx),
|
||||
pieceStorage_(pieceStorage),
|
||||
bitfield_(new BitfieldMan(dctx_->getPieceLength(),
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class DownloadContext;
|
||||
|
@ -76,8 +78,6 @@ public:
|
|||
virtual int64_t getTotalLength() const;
|
||||
};
|
||||
|
||||
typedef SharedHandle<IteratableChunkChecksumValidator> IteratableChunkChecksumValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_ITERATABLE_CHUNK_CHECKSUM_VALIDATOR_H
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#define D_ITERATABLE_VALIDATOR_H
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -65,8 +65,6 @@ public:
|
|||
virtual int64_t getTotalLength() const = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<IteratableValidator> IteratableValidatorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_ITERATABLE_VALIDATOR_H
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "LogFactory.h"
|
||||
#include "Logger.h"
|
||||
#include "BtHandshakeMessage.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "a2netcompat.h"
|
||||
#include "DHKeyExchange.h"
|
||||
#include "ARC4Encryptor.h"
|
||||
|
@ -72,7 +72,7 @@ const unsigned char* GENERATOR = reinterpret_cast<const unsigned char*>("2");
|
|||
|
||||
MSEHandshake::MSEHandshake
|
||||
(cuid_t cuid,
|
||||
const SocketHandle& socket,
|
||||
const SharedHandle<SocketCore>& socket,
|
||||
const Option* op)
|
||||
: cuid_(cuid),
|
||||
socket_(socket),
|
||||
|
|
|
@ -305,7 +305,7 @@ void MultiDiskAdaptor::closeFile()
|
|||
}
|
||||
|
||||
namespace {
|
||||
bool isInRange(const DiskWriterEntryHandle entry, int64_t offset)
|
||||
bool isInRange(const SharedHandle<DiskWriterEntry> entry, int64_t offset)
|
||||
{
|
||||
return entry->getFileEntry()->getOffset() <= offset &&
|
||||
offset < entry->getFileEntry()->getLastOffset();
|
||||
|
@ -313,7 +313,7 @@ bool isInRange(const DiskWriterEntryHandle entry, int64_t offset)
|
|||
} // namespace
|
||||
|
||||
namespace {
|
||||
ssize_t calculateLength(const DiskWriterEntryHandle entry,
|
||||
ssize_t calculateLength(const SharedHandle<DiskWriterEntry> entry,
|
||||
int64_t fileOffset, ssize_t rem)
|
||||
{
|
||||
if(entry->getFileEntry()->getLength() < fileOffset+rem) {
|
||||
|
|
|
@ -97,9 +97,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef SharedHandle<DiskWriterEntry> DiskWriterEntryHandle;
|
||||
|
||||
typedef std::vector<DiskWriterEntryHandle> DiskWriterEntries;
|
||||
typedef std::vector<SharedHandle<DiskWriterEntry> > DiskWriterEntries;
|
||||
|
||||
class MultiDiskAdaptor : public DiskAdaptor {
|
||||
friend class MultiFileAllocationIterator;
|
||||
|
@ -118,7 +116,7 @@ private:
|
|||
|
||||
void openIfNot(const SharedHandle<DiskWriterEntry>& entry,
|
||||
void (DiskWriterEntry::*f)());
|
||||
|
||||
|
||||
static const int DEFAULT_MAX_OPEN_FILES = 100;
|
||||
|
||||
public:
|
||||
|
@ -175,8 +173,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
typedef SharedHandle<MultiDiskAdaptor> MultiDiskAdaptorHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_MULTI_DISK_ADAPTOR_H
|
||||
|
|
|
@ -137,7 +137,7 @@ error_code::Value MultiUrlRequestInfo::execute()
|
|||
Notifier notifier(wsSessionMan);
|
||||
SingletonHolder<Notifier>::instance(¬ifier);
|
||||
|
||||
DownloadEngineHandle e =
|
||||
SharedHandle<DownloadEngine> e =
|
||||
DownloadEngineFactory().newDownloadEngine(option_.get(), requestGroups_);
|
||||
|
||||
if(!option_->blank(PREF_LOAD_COOKIES)) {
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
const SharedHandle<StatCalc>& statCalc,
|
||||
const SharedHandle<OutputFile>& summaryOut,
|
||||
const SharedHandle<UriListParser>& uriListParser);
|
||||
|
||||
|
||||
virtual ~MultiUrlRequestInfo();
|
||||
|
||||
/**
|
||||
|
@ -80,8 +80,6 @@ public:
|
|||
error_code::Value execute();
|
||||
};
|
||||
|
||||
typedef SharedHandle<MultiUrlRequestInfo> MultiUrlRequestInfoHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_MULTI_URL_REQUEST_INFO_H
|
||||
|
|
|
@ -64,13 +64,11 @@ public:
|
|||
|
||||
// Ignores default token of netrc
|
||||
void ignoreDefault();
|
||||
|
||||
|
||||
// Uses default token of netrc
|
||||
void useDefault();
|
||||
};
|
||||
|
||||
typedef SharedHandle<NetrcAuthResolver> NetrcAuthResolverHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_NETRC_AUTH_RESOLVER_H
|
||||
|
|
|
@ -60,8 +60,6 @@ public:
|
|||
virtual void updateFilename() {}
|
||||
};
|
||||
|
||||
typedef SharedHandle<NullProgressInfoFile> NullProgressInfoFileHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_NULL_PROGRESS_INFO_FILE_H
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "DownloadEngine.h"
|
||||
#include "Option.h"
|
||||
#include "DlAbortEx.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "Logger.h"
|
||||
#include "LogFactory.h"
|
||||
#include "message.h"
|
||||
|
@ -53,7 +53,7 @@ PeerAbstractCommand::PeerAbstractCommand
|
|||
(cuid_t cuid,
|
||||
const SharedHandle<Peer>& peer,
|
||||
DownloadEngine* e,
|
||||
const SocketHandle& s)
|
||||
const SharedHandle<SocketCore>& s)
|
||||
: Command(cuid),
|
||||
checkPoint_(global::wallclock()),
|
||||
// TODO referring global option
|
||||
|
@ -136,7 +136,7 @@ void PeerAbstractCommand::disableReadCheckSocket()
|
|||
}
|
||||
}
|
||||
|
||||
void PeerAbstractCommand::setReadCheckSocket(const SocketHandle& socket)
|
||||
void PeerAbstractCommand::setReadCheckSocket(const SharedHandle<SocketCore>& socket)
|
||||
{
|
||||
if(!socket->isOpen()) {
|
||||
disableReadCheckSocket();
|
||||
|
@ -164,7 +164,7 @@ void PeerAbstractCommand::disableWriteCheckSocket()
|
|||
}
|
||||
}
|
||||
|
||||
void PeerAbstractCommand::setWriteCheckSocket(const SocketHandle& socket)
|
||||
void PeerAbstractCommand::setWriteCheckSocket(const SharedHandle<SocketCore>& socket)
|
||||
{
|
||||
if(!socket->isOpen()) {
|
||||
disableWriteCheckSocket();
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "LogFactory.h"
|
||||
#include "Logger.h"
|
||||
#include "BtHandshakeMessage.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "a2netcompat.h"
|
||||
#include "ARC4Encryptor.h"
|
||||
#include "fmt.h"
|
||||
|
@ -64,7 +64,7 @@ enum {
|
|||
} // namespace
|
||||
|
||||
PeerConnection::PeerConnection
|
||||
(cuid_t cuid, const SharedHandle<Peer>& peer, const SocketHandle& socket)
|
||||
(cuid_t cuid, const SharedHandle<Peer>& peer, const SharedHandle<SocketCore>& socket)
|
||||
: cuid_(cuid),
|
||||
peer_(peer),
|
||||
socket_(socket),
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
void presetBuffer(const unsigned char* data, size_t length);
|
||||
|
||||
bool sendBufferIsEmpty() const;
|
||||
|
||||
|
||||
ssize_t sendPendingData();
|
||||
|
||||
const unsigned char* getBuffer() const
|
||||
|
@ -144,8 +144,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<PeerConnection> PeerConnectionHandle;
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_PEER_CONNECTION_H
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "DlAbortEx.h"
|
||||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "Socket.h"
|
||||
#include "SocketCore.h"
|
||||
#include "Logger.h"
|
||||
#include "LogFactory.h"
|
||||
#include "Peer.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue