mirror of https://github.com/aria2/aria2
Fixed some typos in code comments
parent
d0c20e158e
commit
0538aa40da
|
@ -58,7 +58,7 @@ public:
|
||||||
virtual ~AppleTLSSession();
|
virtual ~AppleTLSSession();
|
||||||
|
|
||||||
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
||||||
// tranport socket. This function returns TLS_ERR_OK if it
|
// transport socket. This function returns TLS_ERR_OK if it
|
||||||
// succeeds, or TLS_ERR_ERROR.
|
// succeeds, or TLS_ERR_ERROR.
|
||||||
virtual int init(sock_t sockfd) CXX11_OVERRIDE;
|
virtual int init(sock_t sockfd) CXX11_OVERRIDE;
|
||||||
|
|
||||||
|
@ -81,12 +81,12 @@ public:
|
||||||
|
|
||||||
// Sends |data| with length |len|. This function returns the number
|
// Sends |data| with length |len|. This function returns the number
|
||||||
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
||||||
// underlying tranport blocks, or TLS_ERR_ERROR.
|
// underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t writeData(const void* data, size_t len) CXX11_OVERRIDE;
|
virtual ssize_t writeData(const void* data, size_t len) CXX11_OVERRIDE;
|
||||||
|
|
||||||
// Receives data into |data| with length |len|. This function returns
|
// Receives data into |data| with length |len|. This function returns
|
||||||
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
||||||
// if the underlying tranport blocks, or TLS_ERR_ERROR.
|
// if the underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t readData(void* data, size_t len) CXX11_OVERRIDE;
|
virtual ssize_t readData(void* data, size_t len) CXX11_OVERRIDE;
|
||||||
|
|
||||||
// Performs client side handshake. The |hostname| is the hostname of
|
// Performs client side handshake. The |hostname| is the hostname of
|
||||||
|
|
|
@ -175,11 +175,11 @@ int AsyncNameResolverMan::getStatus() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we got IPv4 lookup response, we don't wait for IPv6 lookup
|
// If we got a IPv4 lookup response, we don't wait for a IPv6 lookup
|
||||||
// response. This is because DNS server may drop AAAA query and we
|
// response. This is because DNS servers may drop AAAA queries and we
|
||||||
// have to wait for the long time before timeout. We don't do the
|
// have to wait for a long time before timeout. We don't do the
|
||||||
// inverse, because, based on todays deployment of DNS server,
|
// inverse, because, based on today's deployment of DNS servers,
|
||||||
// almost all of them can respond A query just fine.
|
// almost all of them can respond to A queries just fine.
|
||||||
if((success && ipv4Success) || success == numResolver_) {
|
if((success && ipv4Success) || success == numResolver_) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if(error == numResolver_) {
|
} else if(error == numResolver_) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ void BtCheckIntegrityEntry::onDownloadFinished
|
||||||
(std::vector<std::unique_ptr<Command>>& commands, DownloadEngine* e)
|
(std::vector<std::unique_ptr<Command>>& commands, DownloadEngine* e)
|
||||||
{
|
{
|
||||||
// TODO Currently,when all the checksums
|
// TODO Currently,when all the checksums
|
||||||
// are valid, then aira2 goes to seeding mode. Sometimes it is better
|
// are valid, then aria2 goes to seeding mode. Sometimes it is better
|
||||||
// to exit rather than doing seeding. So, it would be good to toggle this
|
// to exit rather than doing seeding. So, it would be good to toggle this
|
||||||
// behavior.
|
// behavior.
|
||||||
if(!getRequestGroup()->getOption()->getAsBool(PREF_HASH_CHECK_ONLY) &&
|
if(!getRequestGroup()->getOption()->getAsBool(PREF_HASH_CHECK_ONLY) &&
|
||||||
|
|
|
@ -207,20 +207,20 @@ private:
|
||||||
void updateLru(DomainNode* node, time_t now);
|
void updateLru(DomainNode* node, time_t now);
|
||||||
|
|
||||||
// rootNode_ is a root node of tree structure of reversed domain
|
// rootNode_ is a root node of tree structure of reversed domain
|
||||||
// labels. rootNode_ always contans no cookie. It has the child
|
// labels. rootNode_ always contains no cookie. It has the child
|
||||||
// nodes of the top level domain label (e.g., net, com and org). And
|
// nodes of the top level domain label (e.g., net, com and org). And
|
||||||
// those top level domain nodes have 2nd doman label (e.g.,
|
// those top level domain nodes have 2nd domain label (e.g.,
|
||||||
// sourcforge, github), and so on. The numeric host name are always
|
// sourceforge, github), and so on. The numeric host name are always
|
||||||
// stored as a child node of rootNode_. So the domain name of a
|
// stored as a child node of rootNode_. So the domain name of a
|
||||||
// paricular node is constructed as follows. First traverse the
|
// particular node is constructed as follows. First traverse the
|
||||||
// target node from root node. The concatenation of the visited
|
// target node from root node. The concatenation of the visited
|
||||||
// node's label in the reverse order, delimited by ".", is the
|
// node's label in the reverse order, delimited by ".", is the
|
||||||
std::unique_ptr<DomainNode> rootNode_;
|
std::unique_ptr<DomainNode> rootNode_;
|
||||||
// This object tracks the node which has cookies or it once had. The
|
// This object tracks the node which has cookies or it once had. The
|
||||||
// order is sorted by the least recent updated node first. This
|
// order is sorted by the least recent updated node first. This
|
||||||
// object does not track the node which has not contan cookie. For
|
// object does not track the node which has not contain cookie. For
|
||||||
// example, adding cookies in aria2.sourceforge.net, and no node
|
// example, adding cookies in aria2.sourceforge.net, and no node
|
||||||
// labeled "sourceforge" is present, only node labelded "aria2" is
|
// labeled "sourceforge" is present, only node labeled "aria2" is
|
||||||
// tracked and node labeled "sourceforge" and "net" are not.
|
// tracked and node labeled "sourceforge" and "net" are not.
|
||||||
std::set<std::pair<time_t, DomainNode*>> lruTracker_;
|
std::set<std::pair<time_t, DomainNode*>> lruTracker_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
const std::shared_ptr<DHTBucket>& getBucket() const { return bucket_; }
|
const std::shared_ptr<DHTBucket>& getBucket() const { return bucket_; }
|
||||||
// Splits this object's bucket using DHTBucket::split() and create
|
// Splits this object's bucket using DHTBucket::split() and create
|
||||||
// left and right child node to hold buckets. The bucket of current
|
// left and right child node to hold buckets. The bucket of current
|
||||||
// node is reseted so this node becomes internal node after this
|
// node is reset so this node becomes internal node after this
|
||||||
// call.
|
// call.
|
||||||
void split();
|
void split();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds port. All number in sgl are tried. All numbers in sgl must
|
* Binds port. All number in sgl are tried. All numbers in sgl must
|
||||||
* be in range [1, 65535], inclusive. If successful, the binded port
|
* be in range [1, 65535], inclusive. If successful, the bound port
|
||||||
* is assigned to port and returns true. Otherwise return false and
|
* is assigned to port and returns true. Otherwise return false and
|
||||||
* port is undefined in this case. If non-empty string addr is
|
* port is undefined in this case. If non-empty string addr is
|
||||||
* given, the socket is associated to the address.
|
* given, the socket is associated to the address.
|
||||||
|
@ -66,13 +66,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds port. The port number specified by port is used to bind.
|
* Binds port. The port number specified by port is used to bind.
|
||||||
* If successful, the binded port is assigned to port and returns
|
* If successful, the bound port is assigned to port and returns
|
||||||
* true. Otherwise return false and port is undefined in this case.
|
* true. Otherwise return false and port is undefined in this case.
|
||||||
* If non-empty string addr is given, the socket is associated to
|
* If non-empty string addr is given, the socket is associated to
|
||||||
* the address.
|
* the address.
|
||||||
*
|
*
|
||||||
* If you want to bind arbitrary port, give 0 as port and if successful,
|
* If you want to bind arbitrary port, give 0 as port and if successful,
|
||||||
* the binded port is assigned to port.
|
* the bound port is assigned to port.
|
||||||
*/
|
*/
|
||||||
bool bind(uint16_t& port, const std::string& addr);
|
bool bind(uint16_t& port, const std::string& addr);
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ std::unique_ptr<Dict> DHTGetPeersReplyMessage::getResponse()
|
||||||
rDict->put(family_ == AF_INET?NODES:NODES6, String::g(buffer, offset));
|
rDict->put(family_ == AF_INET?NODES:NODES6, String::g(buffer, offset));
|
||||||
}
|
}
|
||||||
if(!values_.empty()) {
|
if(!values_.empty()) {
|
||||||
// Limit the size of values list. The maxmum size of UDP datagram
|
// Limit the size of values list. The maximum size of UDP datagram
|
||||||
// is limited to 65535 bytes. aria2 uses 20bytes token and 2byte
|
// is limited to 65535 bytes. aria2 uses 20bytes token and 2byte
|
||||||
// transaction ID. The size of get_peers reply message without
|
// transaction ID. The size of get_peers reply message without
|
||||||
// values list and nodes is 87bytes:
|
// values list and nodes is 87bytes:
|
||||||
|
@ -115,7 +115,7 @@ std::unique_ptr<Dict> DHTGetPeersReplyMessage::getResponse()
|
||||||
//
|
//
|
||||||
// Because of Path MTU Discovery, UDP packet size which need not
|
// Because of Path MTU Discovery, UDP packet size which need not
|
||||||
// to be fragmented is much smaller. Since Linux uses Path MTU
|
// to be fragmented is much smaller. Since Linux uses Path MTU
|
||||||
// Dicoverry by default and returning ICMP message might be
|
// Discovery by default and returning ICMP message might be
|
||||||
// filtered, we should avoid fragmentation. MTU of pppoe is 1492
|
// filtered, we should avoid fragmentation. MTU of pppoe is 1492
|
||||||
// max according to RFC2516. We use maximum packet size to be
|
// max according to RFC2516. We use maximum packet size to be
|
||||||
// 1024. Since it contains 20 bytes IP header and 8 bytes UDP
|
// 1024. Since it contains 20 bytes IP header and 8 bytes UDP
|
||||||
|
|
|
@ -446,7 +446,7 @@ void DefaultBtInteractive::detectMessageFlooding() {
|
||||||
void DefaultBtInteractive::checkActiveInteraction()
|
void DefaultBtInteractive::checkActiveInteraction()
|
||||||
{
|
{
|
||||||
time_t inactiveTime = inactiveTimer_.difference(global::wallclock());
|
time_t inactiveTime = inactiveTimer_.difference(global::wallclock());
|
||||||
// To allow aria2 to accept mutially interested peer, disconnect unintersted
|
// To allow aria2 to accept mutially interested peer, disconnect uninterested
|
||||||
// peer.
|
// peer.
|
||||||
{
|
{
|
||||||
const time_t interval = 30;
|
const time_t interval = 30;
|
||||||
|
|
|
@ -211,7 +211,7 @@ bool DownloadCommand::executeInternal() {
|
||||||
// used and Content-Length is known. We check
|
// used and Content-Length is known. We check
|
||||||
// streamFilter_->finished() only if the requested end offset
|
// streamFilter_->finished() only if the requested end offset
|
||||||
// equals to written position in file local offset; in other
|
// equals to written position in file local offset; in other
|
||||||
// words, data in the requested ranage is all received. If
|
// words, data in the requested range is all received. If
|
||||||
// requested end offset is greater than this segment, then
|
// requested end offset is greater than this segment, then
|
||||||
// streamFilter_ is not finished in this segment.
|
// streamFilter_ is not finished in this segment.
|
||||||
segmentPartComplete = true;
|
segmentPartComplete = true;
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace aria2 {
|
||||||
|
|
||||||
typedef std::vector<int> Extensions;
|
typedef std::vector<int> Extensions;
|
||||||
|
|
||||||
// This class stores mapping between BitTorrent entension name and its
|
// This class stores mapping between BitTorrent extension name and its
|
||||||
// ID. The BitTorrent Extension Protocol is specified in BEP10. This
|
// ID. The BitTorrent Extension Protocol is specified in BEP10. This
|
||||||
// class is defined to only stores extensions aria2 supports. See
|
// class is defined to only stores extensions aria2 supports. See
|
||||||
// InterestingExtension for supported extensions.
|
// InterestingExtension for supported extensions.
|
||||||
|
|
|
@ -143,7 +143,7 @@ public:
|
||||||
return spentUris_;
|
return spentUris_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exposed for unitest
|
// Exposed for unittest
|
||||||
std::deque<std::string>& getSpentUris()
|
std::deque<std::string>& getSpentUris()
|
||||||
{
|
{
|
||||||
return spentUris_;
|
return spentUris_;
|
||||||
|
|
|
@ -295,7 +295,7 @@ int FtpConnection::getStatus(const std::string& response) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the length of the reponse if the whole response has been received.
|
// Returns the length of the response if the whole response has been received.
|
||||||
// The length includes \r\n.
|
// The length includes \r\n.
|
||||||
// If the whole response has not been received, then returns std::string::npos.
|
// If the whole response has not been received, then returns std::string::npos.
|
||||||
std::string::size_type
|
std::string::size_type
|
||||||
|
|
|
@ -798,7 +798,7 @@ bool FtpNegotiationCommand::recvRest(const std::shared_ptr<Segment>& segment) {
|
||||||
if(status == 0) {
|
if(status == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If we recieve negative response and requested file position is not 0,
|
// If we receive negative response and requested file position is not 0,
|
||||||
// then throw exception here.
|
// then throw exception here.
|
||||||
if(status != 350) {
|
if(status != 350) {
|
||||||
if(segment && segment->getPositionToWrite() != 0) {
|
if(segment && segment->getPositionToWrite() != 0) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
~GZipEncoder();
|
~GZipEncoder();
|
||||||
|
|
||||||
// Initializes deflator.
|
// Initializes deflater.
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
// Feeds NULL-terminated c-string s to deflater. The deflated
|
// Feeds NULL-terminated c-string s to deflater. The deflated
|
||||||
|
@ -72,12 +72,12 @@ public:
|
||||||
// deflated result is kept in this class.
|
// deflated result is kept in this class.
|
||||||
GZipEncoder& write(const char* s, size_t length);
|
GZipEncoder& write(const char* s, size_t length);
|
||||||
|
|
||||||
// Feeds integer to deflator. Before passed to deflator, i is
|
// Feeds integer to deflater. Before passed to deflater, i is
|
||||||
// converted to std::string using util::itos(). The deflated result
|
// converted to std::string using util::itos(). The deflated result
|
||||||
// is kept in this class.
|
// is kept in this class.
|
||||||
GZipEncoder& operator<<(int64_t i);
|
GZipEncoder& operator<<(int64_t i);
|
||||||
|
|
||||||
// Feeds binary data pointed by in with size length to deflator and
|
// Feeds binary data pointed by in with size length to deflater and
|
||||||
// returns compressed output available so far. Don't use this
|
// returns compressed output available so far. Don't use this
|
||||||
// method with operator<< methods.
|
// method with operator<< methods.
|
||||||
std::string encode(const unsigned char* in, size_t length)
|
std::string encode(const unsigned char* in, size_t length)
|
||||||
|
|
|
@ -214,7 +214,7 @@ HandshakeExtensionMessage::create(const unsigned char* data, size_t length)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only accept metadata smaller than 1MiB. Be aware that broken
|
// Only accept metadata smaller than 1MiB. Be aware that broken
|
||||||
// clinet can send negative size!
|
// client can send negative size!
|
||||||
if(size > 0 && size <= 1024*1024) {
|
if(size > 0 && size <= 1024*1024) {
|
||||||
msg->metadataSize_ = size;
|
msg->metadataSize_ = size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ Range HttpHeader::getRange() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we expect that rangeStr looks like 'bytes 100-199/100'
|
// we expect that rangeStr looks like 'bytes 100-199/100'
|
||||||
// but some server returns '100-199/100', omitting bytes-unit sepcifier
|
// but some server returns '100-199/100', omitting bytes-unit specifier
|
||||||
// 'bytes'.
|
// 'bytes'.
|
||||||
auto byteRangeSpec = std::find(rangeStr.begin(), rangeStr.end(), ' ');
|
auto byteRangeSpec = std::find(rangeStr.begin(), rangeStr.end(), ' ');
|
||||||
if(byteRangeSpec == rangeStr.end()) {
|
if(byteRangeSpec == rangeStr.end()) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ public:
|
||||||
// Clears table_. responseStatus_ and version_ are unchanged.
|
// Clears table_. responseStatus_ and version_ are unchanged.
|
||||||
void clearField();
|
void clearField();
|
||||||
|
|
||||||
// Returns true if heder field |name| contains |value|. This method
|
// Returns true if header field |name| contains |value|. This method
|
||||||
// assumes the values of the header field is delimited by ','.
|
// assumes the values of the header field is delimited by ','.
|
||||||
bool fieldContains(int hdKey, const char* value);
|
bool fieldContains(int hdKey, const char* value);
|
||||||
|
|
||||||
|
|
|
@ -363,7 +363,7 @@ bool HttpResponseCommand::handleDefaultEncoding
|
||||||
// AbstractCommand::execute()
|
// AbstractCommand::execute()
|
||||||
auto segment = getSegmentMan()->getSegmentWithIndex(getCuid(), 0);
|
auto segment = getSegmentMan()->getSegmentWithIndex(getCuid(), 0);
|
||||||
// pipelining requires implicit range specified. But the request for
|
// pipelining requires implicit range specified. But the request for
|
||||||
// this response most likely dones't contains range header. This means
|
// this response most likely doesn't contains range header. This means
|
||||||
// we can't continue to use this socket because server sends all entity
|
// we can't continue to use this socket because server sends all entity
|
||||||
// body instead of a segment.
|
// body instead of a segment.
|
||||||
// Therefore, we shutdown the socket here if pipelining is enabled.
|
// Therefore, we shutdown the socket here if pipelining is enabled.
|
||||||
|
|
|
@ -536,7 +536,7 @@ public:
|
||||||
// the element is moved to the position |offset|. If |how| is
|
// the element is moved to the position |offset|. If |how| is
|
||||||
// OFFSET_MODE_END, the element is moved to the position |offset|
|
// OFFSET_MODE_END, the element is moved to the position |offset|
|
||||||
// relative to the end of the list. This function returns the
|
// relative to the end of the list. This function returns the
|
||||||
// position the elment is moved to if it succeeds, or -1 if no
|
// position the element is moved to if it succeeds, or -1 if no
|
||||||
// element with |key| is found or |how| is invalid. Complexity:
|
// element with |key| is found or |how| is invalid. Complexity:
|
||||||
// O(N)
|
// O(N)
|
||||||
ssize_t move(KeyType key, ssize_t offset, OffsetMode how)
|
ssize_t move(KeyType key, ssize_t offset, OffsetMode how)
|
||||||
|
|
|
@ -133,7 +133,7 @@ InitiateConnectionCommand::createBackupIPv4ConnectCommand
|
||||||
(const std::string& hostname, const std::string& ipaddr, uint16_t port,
|
(const std::string& hostname, const std::string& ipaddr, uint16_t port,
|
||||||
Command* mainCommand)
|
Command* mainCommand)
|
||||||
{
|
{
|
||||||
// Prepare IPv4 backup connection attemp in "Happy Eyeballs"
|
// Prepare IPv4 backup connection attempt in "Happy Eyeballs"
|
||||||
// fashion.
|
// fashion.
|
||||||
std::shared_ptr<BackupConnectInfo> info;
|
std::shared_ptr<BackupConnectInfo> info;
|
||||||
char buf[sizeof(in6_addr)];
|
char buf[sizeof(in6_addr)];
|
||||||
|
|
|
@ -87,7 +87,7 @@ GnuTLSSession::~GnuTLSSession()
|
||||||
// expect that upcoming (at the time of this writing) 3.1.19 and 3.2.9
|
// expect that upcoming (at the time of this writing) 3.1.19 and 3.2.9
|
||||||
// will fix this bug. See
|
// will fix this bug. See
|
||||||
// http://lists.gnutls.org/pipermail/gnutls-devel/2014-January/006679.html
|
// http://lists.gnutls.org/pipermail/gnutls-devel/2014-January/006679.html
|
||||||
// for dtails.
|
// for details.
|
||||||
#if (GNUTLS_VERSION_NUMBER >= 0x030103 && GNUTLS_VERSION_NUMBER <= 0x030112) \
|
#if (GNUTLS_VERSION_NUMBER >= 0x030103 && GNUTLS_VERSION_NUMBER <= 0x030112) \
|
||||||
|| (GNUTLS_VERSION_NUMBER >= 0x030200 && GNUTLS_VERSION_NUMBER <= 0x030208)
|
|| (GNUTLS_VERSION_NUMBER >= 0x030200 && GNUTLS_VERSION_NUMBER <= 0x030208)
|
||||||
# define A2_DISABLE_OCSP 1
|
# define A2_DISABLE_OCSP 1
|
||||||
|
|
|
@ -54,7 +54,7 @@ void LogFactory::openLogger(const std::shared_ptr<Logger>& logger)
|
||||||
{
|
{
|
||||||
if(filename_ != DEV_NULL) {
|
if(filename_ != DEV_NULL) {
|
||||||
// don't open file DEV_NULL for performance sake.
|
// don't open file DEV_NULL for performance sake.
|
||||||
// This avoids costly unecessary message formatting and write.
|
// This avoids costly unnecessary message formatting and write.
|
||||||
logger->openFile(filename_);
|
logger->openFile(filename_);
|
||||||
}
|
}
|
||||||
logger->setLogLevel(logLevel_);
|
logger->setLogLevel(logLevel_);
|
||||||
|
|
|
@ -228,7 +228,7 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
torrentRg->clearPreDownloadHandler();
|
torrentRg->clearPreDownloadHandler();
|
||||||
torrentRg->clearPostDownloadHandler();
|
torrentRg->clearPostDownloadHandler();
|
||||||
// remove "metalink" from Accept Type list to avoid loop in
|
// remove "metalink" from Accept Type list to avoid loop in
|
||||||
// tranparent metalink
|
// transparent metalink
|
||||||
torrentRg->getDownloadContext()->setAcceptMetalink(false);
|
torrentRg->getDownloadContext()->setAcceptMetalink(false);
|
||||||
// make it in-memory download
|
// make it in-memory download
|
||||||
torrentRg->addPreDownloadHandler
|
torrentRg->addPreDownloadHandler
|
||||||
|
@ -327,10 +327,10 @@ Metalink2RequestGroup::createRequestGroup
|
||||||
|
|
||||||
removeOneshotOption(option);
|
removeOneshotOption(option);
|
||||||
// remove "metalink" from Accept Type list to avoid loop in
|
// remove "metalink" from Accept Type list to avoid loop in
|
||||||
// tranparent metalink
|
// transparent metalink
|
||||||
dctx->setAcceptMetalink(false);
|
dctx->setAcceptMetalink(false);
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
// Inject depenency between rg and torrentRg here if
|
// Inject dependency between rg and torrentRg here if
|
||||||
// torrentRg is true
|
// torrentRg is true
|
||||||
if(torrentRg) {
|
if(torrentRg) {
|
||||||
auto dep = std::make_shared<BtDependency>(rg.get(), torrentRg);
|
auto dep = std::make_shared<BtDependency>(rg.get(), torrentRg);
|
||||||
|
|
|
@ -355,9 +355,9 @@ void ResourcesMetalinkParserState::beginElement
|
||||||
}
|
}
|
||||||
else if(util::parseIntNoThrow(preference, std::string((*itr).value, (*itr).valueLength)) &&
|
else if(util::parseIntNoThrow(preference, std::string((*itr).value, (*itr).valueLength)) &&
|
||||||
preference >= 0) {
|
preference >= 0) {
|
||||||
// In Metalink3Spec, highest prefernce value is 100. We
|
// In Metalink3Spec, highest preference value is 100. We
|
||||||
// use Metalink4Spec priority unit system in which 1 is
|
// use Metalink4Spec priority unit system in which 1 is
|
||||||
// higest.
|
// highest.
|
||||||
preference = 101-preference;
|
preference = 101-preference;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -162,13 +162,13 @@ void MultiDiskAdaptor::resetDiskWriterEntries()
|
||||||
}
|
}
|
||||||
} else if(fileEntry->getOffset() < lastOffset) {
|
} else if(fileEntry->getOffset() < lastOffset) {
|
||||||
// The files which shares last piece are not needed to be
|
// The files which shares last piece are not needed to be
|
||||||
// allocated. They just requre DiskWriter
|
// allocated. They just require DiskWriter
|
||||||
A2_LOG_DEBUG(fmt("%s needs DiskWriter",
|
A2_LOG_DEBUG(fmt("%s needs DiskWriter",
|
||||||
fileEntry->getPath().c_str()));
|
fileEntry->getPath().c_str()));
|
||||||
dwent->needsDiskWriter(true);
|
dwent->needsDiskWriter(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check shared piece backword
|
// Check shared piece backward
|
||||||
lastOffset = std::numeric_limits<int64_t>::max();
|
lastOffset = std::numeric_limits<int64_t>::max();
|
||||||
for(auto i = diskWriterEntries_.rbegin(), eoi = diskWriterEntries_.rend();
|
for(auto i = diskWriterEntries_.rbegin(), eoi = diskWriterEntries_.rend();
|
||||||
i != eoi; ++i) {
|
i != eoi; ++i) {
|
||||||
|
|
|
@ -352,7 +352,7 @@ IndexOutOptionHandler::~IndexOutOptionHandler() {}
|
||||||
void IndexOutOptionHandler::parseArg(Option& option, const std::string& optarg)
|
void IndexOutOptionHandler::parseArg(Option& option, const std::string& optarg)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
// See optarg is in the fomrat of "INDEX=PATH"
|
// See optarg is in the format of "INDEX=PATH"
|
||||||
util::parseIndexPath(optarg);
|
util::parseIndexPath(optarg);
|
||||||
std::string value = option.get(pref_);
|
std::string value = option.get(pref_);
|
||||||
value += optarg;
|
value += optarg;
|
||||||
|
|
|
@ -270,7 +270,7 @@ private:
|
||||||
public:
|
public:
|
||||||
// depOptHandler is deprecated option and repOptHandler is replacing
|
// depOptHandler is deprecated option and repOptHandler is replacing
|
||||||
// new option. If there is no replacing option, specify nullptr. If
|
// new option. If there is no replacing option, specify nullptr. If
|
||||||
// there is no replacing option, but the option still alives, give
|
// there is no replacing option, but the option still lives, give
|
||||||
// true to stillWork. Set additional message to additionalMessage.
|
// true to stillWork. Set additional message to additionalMessage.
|
||||||
DeprecatedOptionHandler
|
DeprecatedOptionHandler
|
||||||
(OptionHandler* depOptHandler,
|
(OptionHandler* depOptHandler,
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
const OptionHandler* findByShortName(char shortName) const;
|
const OptionHandler* findByShortName(char shortName) const;
|
||||||
|
|
||||||
static const std::shared_ptr<OptionParser>& getInstance();
|
static const std::shared_ptr<OptionParser>& getInstance();
|
||||||
// Deletes statically allocated instace. Call this at the end of the
|
// Deletes statically allocated instance. Call this at the end of the
|
||||||
// program.
|
// program.
|
||||||
static void deleteInstance();
|
static void deleteInstance();
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,12 +59,12 @@ public:
|
||||||
virtual bool execute() CXX11_OVERRIDE;
|
virtual bool execute() CXX11_OVERRIDE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds port. If successful, the binded port number is assinged to port and
|
* Binds port. If successful, the bound port number is assinged to port and
|
||||||
* returns true, otherwise port is undefined and returns false.
|
* returns true, otherwise port is undefined and returns false.
|
||||||
*/
|
*/
|
||||||
bool bindPort(uint16_t& port, SegList<int>& seq);
|
bool bindPort(uint16_t& port, SegList<int>& seq);
|
||||||
|
|
||||||
// Returns binded port
|
// Returns bound port
|
||||||
uint16_t getPort() const;
|
uint16_t getPort() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ bool Platform::tearDown()
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif // HAVE_WINSOCK2_H
|
#endif // HAVE_WINSOCK2_H
|
||||||
// Deletes statically allocated resources. This is done to
|
// Deletes statically allocated resources. This is done to
|
||||||
// distinguish memory leak from them. This is handly to use
|
// distinguish memory leak from them. This is handy to use
|
||||||
// valgrind.
|
// valgrind.
|
||||||
OptionParser::deleteInstance();
|
OptionParser::deleteInstance();
|
||||||
option::deletePrefResource();
|
option::deletePrefResource();
|
||||||
|
|
|
@ -405,7 +405,7 @@ public:
|
||||||
PREF_ON_DOWNLOAD_PAUSE);
|
PREF_ON_DOWNLOAD_PAUSE);
|
||||||
notifyDownloadEvent(EVENT_ON_DOWNLOAD_PAUSE, group);
|
notifyDownloadEvent(EVENT_ON_DOWNLOAD_PAUSE, group);
|
||||||
// TODO Should we have to prepend spend uris to remaining uris
|
// TODO Should we have to prepend spend uris to remaining uris
|
||||||
// in case PREF_REUSE_URI is disabed?
|
// in case PREF_REUSE_URI is disabled?
|
||||||
} else {
|
} else {
|
||||||
std::shared_ptr<DownloadResult> dr = group->createDownloadResult();
|
std::shared_ptr<DownloadResult> dr = group->createDownloadResult();
|
||||||
e_->getRequestGroupMan()->addDownloadResult(dr);
|
e_->getRequestGroupMan()->addDownloadResult(dr);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns next value. Advance current position to the next. If
|
// Returns next value. Advance current position to the next. If
|
||||||
// this fuction is called when hasNext() returns false, returns 0.
|
// this function is called when hasNext() returns false, returns 0.
|
||||||
T next()
|
T next()
|
||||||
{
|
{
|
||||||
T res;
|
T res;
|
||||||
|
@ -125,7 +125,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns next value. Current position is not advanced. If
|
// Returns next value. Current position is not advanced. If
|
||||||
// this fuction is called when hasNext() returns false, returns 0.
|
// this function is called when hasNext() returns false, returns 0.
|
||||||
T peek() const
|
T peek() const
|
||||||
{
|
{
|
||||||
T res;
|
T res;
|
||||||
|
|
|
@ -177,7 +177,7 @@ namespace {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// The downloads whose followedBy() is empty is persisited with its
|
// The downloads whose followedBy() is empty is persisted with its
|
||||||
// GID without no problem. For other cases, there are several patterns.
|
// GID without no problem. For other cases, there are several patterns.
|
||||||
//
|
//
|
||||||
// 1. magnet URI
|
// 1. magnet URI
|
||||||
|
@ -202,7 +202,7 @@ bool writeDownloadResult
|
||||||
}
|
}
|
||||||
if(!mi) {
|
if(!mi) {
|
||||||
// With --force-save option, same gid may be saved twice. (e.g.,
|
// With --force-save option, same gid may be saved twice. (e.g.,
|
||||||
// Downloading .meta4 followed by its conent download. First
|
// Downloading .meta4 followed by its content download. First
|
||||||
// .meta4 download is saved and second content download is also
|
// .meta4 download is saved and second content download is also
|
||||||
// saved with the same gid.)
|
// saved with the same gid.)
|
||||||
if(metainfoCache.count(dr->gid->getNumericId()) != 0) {
|
if(metainfoCache.count(dr->gid->getNumericId()) != 0) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
SocketBuffer(const SocketBuffer&) = delete;
|
SocketBuffer(const SocketBuffer&) = delete;
|
||||||
SocketBuffer& operator=(const SocketBuffer&) = delete;
|
SocketBuffer& operator=(const SocketBuffer&) = delete;
|
||||||
|
|
||||||
// Feeds data pointered by bytes with length len into queue. This
|
// Feeds data pointed by bytes with length len into queue. This
|
||||||
// object gets ownership of bytes, so caller must not delete or
|
// object gets ownership of bytes, so caller must not delete or
|
||||||
// later bytes after this call. This function doesn't send data. If
|
// later bytes after this call. This function doesn't send data. If
|
||||||
// progressUpdate is not null, its update() function will be called
|
// progressUpdate is not null, its update() function will be called
|
||||||
|
|
|
@ -866,7 +866,7 @@ bool SocketCore::tlsHandshake(TLSContext* tlsctx, const std::string& hostname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(secure_ == A2_TLS_HANDSHAKING) {
|
if(secure_ == A2_TLS_HANDSHAKING) {
|
||||||
// Starting handshake after intial setup or still handshaking.
|
// Starting handshake after initial setup or still handshaking.
|
||||||
TLSVersion ver = TLS_PROTO_NONE;
|
TLSVersion ver = TLS_PROTO_NONE;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
std::string handshakeError;
|
std::string handshakeError;
|
||||||
|
|
|
@ -352,7 +352,7 @@ int callGetaddrinfo
|
||||||
(struct addrinfo** resPtr, const char* host, const char* service, int family,
|
(struct addrinfo** resPtr, const char* host, const char* service, int family,
|
||||||
int sockType, int flags, int protocol);
|
int sockType, int flags, int protocol);
|
||||||
|
|
||||||
// Collects IP addresses of given inteface iface and stores in
|
// Collects IP addresses of given interface iface and stores in
|
||||||
// ifAddres. iface may be specified as a hostname, IP address or
|
// ifAddres. iface may be specified as a hostname, IP address or
|
||||||
// interface name like eth0. You can limit the family of IP addresses
|
// interface name like eth0. You can limit the family of IP addresses
|
||||||
// to collect using family argument. aiFlags is passed to
|
// to collect using family argument. aiFlags is passed to
|
||||||
|
|
|
@ -102,7 +102,7 @@ void SpeedCalc::update(size_t bytes)
|
||||||
int SpeedCalc::calculateAvgSpeed() const
|
int SpeedCalc::calculateAvgSpeed() const
|
||||||
{
|
{
|
||||||
int64_t milliElapsed = start_.differenceInMillis(global::wallclock());
|
int64_t milliElapsed = start_.differenceInMillis(global::wallclock());
|
||||||
// if milliElapsed is too small, the average speed is rubish, better
|
// if milliElapsed is too small, the average speed is rubbish, better
|
||||||
// return 0
|
// return 0
|
||||||
if(milliElapsed > 4) {
|
if(milliElapsed > 4) {
|
||||||
int speed = accumulatedLength_*1000/milliElapsed;
|
int speed = accumulatedLength_*1000/milliElapsed;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
virtual const std::string& getName() const = 0;
|
virtual const std::string& getName() const = 0;
|
||||||
|
|
||||||
// Returns the number of input bytes processed in the last
|
// Returns the number of input bytes processed in the last
|
||||||
// tranfrom() invocation.
|
// transform() invocation.
|
||||||
virtual size_t getBytesProcessed() const = 0;
|
virtual size_t getBytesProcessed() const = 0;
|
||||||
|
|
||||||
virtual bool installDelegate(std::unique_ptr<StreamFilter> filter);
|
virtual bool installDelegate(std::unique_ptr<StreamFilter> filter);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
virtual ~TLSSession() {}
|
virtual ~TLSSession() {}
|
||||||
|
|
||||||
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
||||||
// tranport socket. This function returns TLS_ERR_OK if it
|
// transport socket. This function returns TLS_ERR_OK if it
|
||||||
// succeeds, or TLS_ERR_ERROR.
|
// succeeds, or TLS_ERR_ERROR.
|
||||||
virtual int init(sock_t sockfd) = 0;
|
virtual int init(sock_t sockfd) = 0;
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ public:
|
||||||
|
|
||||||
// Sends |data| with length |len|. This function returns the number
|
// Sends |data| with length |len|. This function returns the number
|
||||||
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
||||||
// underlying tranport blocks, or TLS_ERR_ERROR.
|
// underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t writeData(const void* data, size_t len) = 0;
|
virtual ssize_t writeData(const void* data, size_t len) = 0;
|
||||||
|
|
||||||
// Receives data into |data| with length |len|. This function returns
|
// Receives data into |data| with length |len|. This function returns
|
||||||
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
||||||
// if the underlying tranport blocks, or TLS_ERR_ERROR.
|
// if the underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t readData(void* data, size_t len) = 0;
|
virtual ssize_t readData(void* data, size_t len) = 0;
|
||||||
|
|
||||||
// Performs client side handshake. The |hostname| is the hostname of
|
// Performs client side handshake. The |hostname| is the hostname of
|
||||||
|
|
|
@ -154,7 +154,7 @@ int UDPTrackerClient::receiveReply
|
||||||
transactionId, connectionId));
|
transactionId, connectionId));
|
||||||
UDPTrackerConnection c(UDPT_CST_CONNECTED, connectionId, now);
|
UDPTrackerConnection c(UDPT_CST_CONNECTED, connectionId, now);
|
||||||
connectionIdCache_[std::make_pair(remoteAddr, remotePort)] = c;
|
connectionIdCache_[std::make_pair(remoteAddr, remotePort)] = c;
|
||||||
// Now we have connecion ID, push requests which are waiting for
|
// Now we have connection ID, push requests which are waiting for
|
||||||
// it.
|
// it.
|
||||||
std::vector<std::shared_ptr<UDPTrackerRequest> > reqs;
|
std::vector<std::shared_ptr<UDPTrackerRequest> > reqs;
|
||||||
connectRequests_.erase(std::remove_if
|
connectRequests_.erase(std::remove_if
|
||||||
|
@ -512,7 +512,7 @@ void UDPTrackerClient::failConnect(const std::string& remoteAddr,
|
||||||
uint16_t remotePort, int error)
|
uint16_t remotePort, int error)
|
||||||
{
|
{
|
||||||
connectionIdCache_.erase(std::make_pair(remoteAddr, remotePort));
|
connectionIdCache_.erase(std::make_pair(remoteAddr, remotePort));
|
||||||
// Fail all requests which are waiting for connecion ID of the host.
|
// Fail all requests which are waiting for connection ID of the host.
|
||||||
connectRequests_.erase(std::remove_if(connectRequests_.begin(),
|
connectRequests_.erase(std::remove_if(connectRequests_.begin(),
|
||||||
connectRequests_.end(),
|
connectRequests_.end(),
|
||||||
FailConnectDelete
|
FailConnectDelete
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
|
|
||||||
ValueType popValue() const;
|
ValueType popValue() const;
|
||||||
|
|
||||||
// Returns std::string.data() casted to unsigned char*.
|
// Returns std::string.data() cast to unsigned char*.
|
||||||
// Use s().size() to get length.
|
// Use s().size() to get length.
|
||||||
const unsigned char* uc() const;
|
const unsigned char* uc() const;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ public:
|
||||||
// Appends given v to list.
|
// Appends given v to list.
|
||||||
void append(std::unique_ptr<ValueBase> v);
|
void append(std::unique_ptr<ValueBase> v);
|
||||||
|
|
||||||
// Appeding string is so common that we provide shortcut function.
|
// Appending string is so common that we provide shortcut function.
|
||||||
void append(String::ValueType string);
|
void append(String::ValueType string);
|
||||||
|
|
||||||
// Alias for append()
|
// Alias for append()
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
bool closeReceived();
|
bool closeReceived();
|
||||||
// Returns true if the close frame is sent.
|
// Returns true if the close frame is sent.
|
||||||
bool closeSent();
|
bool closeSent();
|
||||||
// Parses parital request body. This function returns the number of
|
// Parses partial request body. This function returns the number of
|
||||||
// bytes processed if it succeeds, or negative error code.
|
// bytes processed if it succeeds, or negative error code.
|
||||||
ssize_t parseUpdate(const uint8_t* data, size_t len);
|
ssize_t parseUpdate(const uint8_t* data, size_t len);
|
||||||
// Parses final part of request body and returns result. The
|
// Parses final part of request body and returns result. The
|
||||||
|
|
|
@ -152,13 +152,13 @@ void WinTLSContext::setVerifyPeer(bool verify)
|
||||||
|
|
||||||
if (credentials_.dwMinimumCipherStrength > WEAK_CIPHER_BITS) {
|
if (credentials_.dwMinimumCipherStrength > WEAK_CIPHER_BITS) {
|
||||||
// Enable strong crypto if we already set a minimum cipher streams.
|
// Enable strong crypto if we already set a minimum cipher streams.
|
||||||
// This might actually require evem stronger algorithms, which is a good
|
// This might actually require even stronger algorithms, which is a good
|
||||||
// thing.
|
// thing.
|
||||||
credentials_.dwFlags |= SCH_USE_STRONG_CRYPTO;
|
credentials_.dwFlags |= SCH_USE_STRONG_CRYPTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (side_ != TLS_CLIENT || !verify) {
|
if (side_ != TLS_CLIENT || !verify) {
|
||||||
// No verfication for servers and if user explicitly requested it
|
// No verification for servers and if user explicitly requested it
|
||||||
credentials_.dwFlags |= SCH_CRED_MANUAL_CRED_VALIDATION |
|
credentials_.dwFlags |= SCH_CRED_MANUAL_CRED_VALIDATION |
|
||||||
SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
|
SCH_CRED_IGNORE_NO_REVOCATION_CHECK |
|
||||||
SCH_CRED_IGNORE_REVOCATION_OFFLINE |
|
SCH_CRED_IGNORE_REVOCATION_OFFLINE |
|
||||||
|
|
|
@ -395,7 +395,7 @@ ssize_t WinTLSSession::writeData(const void* data, size_t len)
|
||||||
}
|
}
|
||||||
dl += buffers[1].cbBuffer;
|
dl += buffers[1].cbBuffer;
|
||||||
if (dl < streamSizes_->cbHeader + writeBuffered_) {
|
if (dl < streamSizes_->cbHeader + writeBuffered_) {
|
||||||
// Move tailer.
|
// Move trailer.
|
||||||
memmove(buf.get() + dl, buffers[2].pvBuffer, buffers[2].cbBuffer);
|
memmove(buf.get() + dl, buffers[2].pvBuffer, buffers[2].cbBuffer);
|
||||||
}
|
}
|
||||||
dl += buffers[2].cbBuffer;
|
dl += buffers[2].cbBuffer;
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
virtual ~WinTLSSession();
|
virtual ~WinTLSSession();
|
||||||
|
|
||||||
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
// Initializes SSL/TLS session. The |sockfd| is the underlying
|
||||||
// tranport socket. This function returns TLS_ERR_OK if it
|
// transport socket. This function returns TLS_ERR_OK if it
|
||||||
// succeeds, or TLS_ERR_ERROR.
|
// succeeds, or TLS_ERR_ERROR.
|
||||||
virtual int init(sock_t sockfd) CXX11_OVERRIDE;
|
virtual int init(sock_t sockfd) CXX11_OVERRIDE;
|
||||||
|
|
||||||
|
@ -161,12 +161,12 @@ public:
|
||||||
|
|
||||||
// Sends |data| with length |len|. This function returns the number
|
// Sends |data| with length |len|. This function returns the number
|
||||||
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
// of bytes sent if it succeeds, or TLS_ERR_WOULDBLOCK if the
|
||||||
// underlying tranport blocks, or TLS_ERR_ERROR.
|
// underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t writeData(const void* data, size_t len) CXX11_OVERRIDE;
|
virtual ssize_t writeData(const void* data, size_t len) CXX11_OVERRIDE;
|
||||||
|
|
||||||
// Receives data into |data| with length |len|. This function returns
|
// Receives data into |data| with length |len|. This function returns
|
||||||
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
// the number of bytes received if it succeeds, or TLS_ERR_WOULDBLOCK
|
||||||
// if the underlying tranport blocks, or TLS_ERR_ERROR.
|
// if the underlying transport blocks, or TLS_ERR_ERROR.
|
||||||
virtual ssize_t readData(void* data, size_t len) CXX11_OVERRIDE;
|
virtual ssize_t readData(void* data, size_t len) CXX11_OVERRIDE;
|
||||||
|
|
||||||
// Performs client side handshake. The |hostname| is the hostname of
|
// Performs client side handshake. The |hostname| is the hostname of
|
||||||
|
@ -197,7 +197,7 @@ private:
|
||||||
// Buffer for already encrypted writes
|
// Buffer for already encrypted writes
|
||||||
wintls::Buffer writeBuf_;
|
wintls::Buffer writeBuf_;
|
||||||
// While the writeBuf_ holds encrypted messages, writeBuffered_ has the
|
// While the writeBuf_ holds encrypted messages, writeBuffered_ has the
|
||||||
// corresponding size of unencrpted data used to procude the messages.
|
// corresponding size of unencrypted data used to produce the messages.
|
||||||
size_t writeBuffered_;
|
size_t writeBuffered_;
|
||||||
// Buffer for still encrypted reads
|
// Buffer for still encrypted reads
|
||||||
wintls::Buffer readBuf_;
|
wintls::Buffer readBuf_;
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
# define S_IRGRP 0000040 /* read permission, group */
|
# define S_IRGRP 0000040 /* read permission, group */
|
||||||
#endif /* S_IRGRP */
|
#endif /* S_IRGRP */
|
||||||
#ifndef S_IWGRP
|
#ifndef S_IWGRP
|
||||||
# define S_IWGRP 0000020 /* write permission, grougroup */
|
# define S_IWGRP 0000020 /* write permission, group */
|
||||||
#endif /* S_IWGRP */
|
#endif /* S_IWGRP */
|
||||||
#ifndef S_IXGRP
|
#ifndef S_IXGRP
|
||||||
# define S_IXGRP 0000010/* execute/search permission, group */
|
# define S_IXGRP 0000010/* execute/search permission, group */
|
||||||
|
|
|
@ -477,7 +477,7 @@ void processRootDictionary
|
||||||
torrent->privateTorrent = true;
|
torrent->privateTorrent = true;
|
||||||
}
|
}
|
||||||
// retrieve uri-list.
|
// retrieve uri-list.
|
||||||
// This implemantation obeys HTTP-Seeding specification:
|
// This implementation obeys HTTP-Seeding specification:
|
||||||
// see http://www.getright.com/seedtorrent.html
|
// see http://www.getright.com/seedtorrent.html
|
||||||
std::vector<std::string> urlList;
|
std::vector<std::string> urlList;
|
||||||
extractUrlList(torrent.get(), urlList, rootDict->get(C_URL_LIST));
|
extractUrlList(torrent.get(), urlList, rootDict->get(C_URL_LIST));
|
||||||
|
|
|
@ -120,14 +120,14 @@ void loadFromMemory(const ValueBase* torrent,
|
||||||
std::unique_ptr<TorrentAttribute> parseMagnet(const std::string& magnet);
|
std::unique_ptr<TorrentAttribute> parseMagnet(const std::string& magnet);
|
||||||
|
|
||||||
// Parses BitTorrent Magnet URI and set them in ctx as a
|
// Parses BitTorrent Magnet URI and set them in ctx as a
|
||||||
// bittorrent::BITTORRENT attibute. If parsing operation failed, an
|
// bittorrent::BITTORRENT attribute. If parsing operation failed, an
|
||||||
// RecoverableException will be thrown.
|
// RecoverableException will be thrown.
|
||||||
void loadMagnet
|
void loadMagnet
|
||||||
(const std::string& magnet, const std::shared_ptr<DownloadContext>& ctx);
|
(const std::string& magnet, const std::shared_ptr<DownloadContext>& ctx);
|
||||||
|
|
||||||
// Generates Peer ID. BitTorrent specification says Peer ID is 20-byte
|
// Generates Peer ID. BitTorrent specification says Peer ID is 20-byte
|
||||||
// length. This function uses peerIdPrefix as a Peer ID and it is
|
// length. This function uses peerIdPrefix as a Peer ID and it is
|
||||||
// less than 20bytes, random bytes are generated and appened to it. If
|
// less than 20bytes, random bytes are generated and appended to it. If
|
||||||
// peerIdPrefix is larger than 20bytes, first 20bytes are used.
|
// peerIdPrefix is larger than 20bytes, first 20bytes are used.
|
||||||
std::string generatePeerId(const std::string& peerIdPrefix);
|
std::string generatePeerId(const std::string& peerIdPrefix);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ std::vector<size_t> computeFastSet
|
||||||
(const std::string& ipaddr,
|
(const std::string& ipaddr,
|
||||||
size_t numPieces, const unsigned char* infoHash, size_t fastSetSize);
|
size_t numPieces, const unsigned char* infoHash, size_t fastSetSize);
|
||||||
|
|
||||||
// Make sure that don't recieve return value into std::shared_ptr.
|
// Make sure that don't receive return value into std::shared_ptr.
|
||||||
TorrentAttribute* getTorrentAttrs(DownloadContext* dctx);
|
TorrentAttribute* getTorrentAttrs(DownloadContext* dctx);
|
||||||
TorrentAttribute* getTorrentAttrs
|
TorrentAttribute* getTorrentAttrs
|
||||||
(const std::shared_ptr<DownloadContext>& dctx);
|
(const std::shared_ptr<DownloadContext>& dctx);
|
||||||
|
|
|
@ -75,7 +75,7 @@ static forceinline T par(T b, T c, T d)
|
||||||
using namespace crypto;
|
using namespace crypto;
|
||||||
using namespace crypto::hash;
|
using namespace crypto::hash;
|
||||||
|
|
||||||
// Our base implementation, doing most of the work, short of |tranform|,
|
// Our base implementation, doing most of the work, short of |transform|,
|
||||||
// |digest| and initialization.
|
// |digest| and initialization.
|
||||||
template <typename word_, uint_fast8_t bsize, uint_fast8_t ssize>
|
template <typename word_, uint_fast8_t bsize, uint_fast8_t ssize>
|
||||||
class AlgorithmImpl : public Algorithm
|
class AlgorithmImpl : public Algorithm
|
||||||
|
@ -232,7 +232,7 @@ protected:
|
||||||
a1 += a2;
|
a1 += a2;
|
||||||
|
|
||||||
// Yeah, unrolled loops.
|
// Yeah, unrolled loops.
|
||||||
// This stuff is generated, but accidentially deleted the generator script.
|
// This stuff is generated, but accidentally deleted the generator script.
|
||||||
|
|
||||||
r(f1, a, b, c, d, w00, 0xd76aa478, 7);
|
r(f1, a, b, c, d, w00, 0xd76aa478, 7);
|
||||||
r(f1, d, a, b, c, w01, 0xe8c7b756, 12);
|
r(f1, d, a, b, c, w01, 0xe8c7b756, 12);
|
||||||
|
|
|
@ -121,7 +121,7 @@ void createRequestGroupForUriList
|
||||||
const std::shared_ptr<Option>& option);
|
const std::shared_ptr<Option>& option);
|
||||||
|
|
||||||
// Create RequestGroup object using provided uris. If ignoreLocalPath
|
// Create RequestGroup object using provided uris. If ignoreLocalPath
|
||||||
// is true, a path to torrent file abd metalink file are ignored. If
|
// is true, a path to torrent file and metalink file are ignored. If
|
||||||
// throwOnError is true, exception will be thrown when Metalink
|
// throwOnError is true, exception will be thrown when Metalink
|
||||||
// Document or .torrent file cannot be parsed or unrecognized URI is
|
// Document or .torrent file cannot be parsed or unrecognized URI is
|
||||||
// given. If throwOnError is false, these errors are just logged as
|
// given. If throwOnError is false, these errors are just logged as
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MessageDigest;
|
||||||
namespace message_digest {
|
namespace message_digest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ctx must be initialized or reseted before calling this function.
|
* ctx must be initialized or reset before calling this function.
|
||||||
* Returns raw digest string, not hex digest
|
* Returns raw digest string, not hex digest
|
||||||
*/
|
*/
|
||||||
std::string digest
|
std::string digest
|
||||||
|
|
|
@ -195,7 +195,7 @@ InputIterator expandLoop
|
||||||
//
|
//
|
||||||
// When loop through START to END, we include both START and END.
|
// When loop through START to END, we include both START and END.
|
||||||
//
|
//
|
||||||
// STEP is dicimal number and it is used as loop step. STEP can be
|
// STEP is decimal number and it is used as loop step. STEP can be
|
||||||
// omitted. If omitted, preceding ':' also must be omitted.
|
// omitted. If omitted, preceding ':' also must be omitted.
|
||||||
//
|
//
|
||||||
// START, END and STEP must be less than or equal to 65535 in decimal.
|
// START, END and STEP must be less than or equal to 65535 in decimal.
|
||||||
|
|
|
@ -371,7 +371,7 @@ PrefPtr PREF_DSCP = makePref("dscp");
|
||||||
PrefPtr PREF_PAUSE_METADATA = makePref("pause-metadata");
|
PrefPtr PREF_PAUSE_METADATA = makePref("pause-metadata");
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
PrefPtr PREF_RLIMIT_NOFILE = makePref("rlimit-nofile");
|
PrefPtr PREF_RLIMIT_NOFILE = makePref("rlimit-nofile");
|
||||||
// vlaues: SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2
|
// values: SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2
|
||||||
PrefPtr PREF_MIN_TLS_VERSION = makePref("min-tls-version");
|
PrefPtr PREF_MIN_TLS_VERSION = makePref("min-tls-version");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -429,7 +429,7 @@ PrefPtr PREF_HTTP_PROXY = makePref("http-proxy");
|
||||||
PrefPtr PREF_HTTPS_PROXY = makePref("https-proxy");
|
PrefPtr PREF_HTTPS_PROXY = makePref("https-proxy");
|
||||||
PrefPtr PREF_FTP_PROXY = makePref("ftp-proxy");
|
PrefPtr PREF_FTP_PROXY = makePref("ftp-proxy");
|
||||||
PrefPtr PREF_ALL_PROXY = makePref("all-proxy");
|
PrefPtr PREF_ALL_PROXY = makePref("all-proxy");
|
||||||
// values: comma separeted hostname or domain
|
// values: comma separated hostname or domain
|
||||||
PrefPtr PREF_NO_PROXY = makePref("no-proxy");
|
PrefPtr PREF_NO_PROXY = makePref("no-proxy");
|
||||||
// values: get | tunnel
|
// values: get | tunnel
|
||||||
PrefPtr PREF_PROXY_METHOD = makePref("proxy-method");
|
PrefPtr PREF_PROXY_METHOD = makePref("proxy-method");
|
||||||
|
|
|
@ -308,7 +308,7 @@ extern PrefPtr PREF_DSCP;
|
||||||
extern PrefPtr PREF_PAUSE_METADATA;
|
extern PrefPtr PREF_PAUSE_METADATA;
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
extern PrefPtr PREF_RLIMIT_NOFILE;
|
extern PrefPtr PREF_RLIMIT_NOFILE;
|
||||||
// vlaues: SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2
|
// values: SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2
|
||||||
extern PrefPtr PREF_MIN_TLS_VERSION;
|
extern PrefPtr PREF_MIN_TLS_VERSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -366,7 +366,7 @@ extern PrefPtr PREF_HTTP_PROXY;
|
||||||
extern PrefPtr PREF_HTTPS_PROXY;
|
extern PrefPtr PREF_HTTPS_PROXY;
|
||||||
extern PrefPtr PREF_FTP_PROXY;
|
extern PrefPtr PREF_FTP_PROXY;
|
||||||
extern PrefPtr PREF_ALL_PROXY;
|
extern PrefPtr PREF_ALL_PROXY;
|
||||||
// values: comma separeted hostname or domain
|
// values: comma separated hostname or domain
|
||||||
extern PrefPtr PREF_NO_PROXY;
|
extern PrefPtr PREF_NO_PROXY;
|
||||||
// values: get | tunnel
|
// values: get | tunnel
|
||||||
extern PrefPtr PREF_PROXY_METHOD;
|
extern PrefPtr PREF_PROXY_METHOD;
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace aria2 {
|
||||||
|
|
||||||
namespace global {
|
namespace global {
|
||||||
|
|
||||||
// Global clock, this clock is reseted before executeCommand() call to
|
// Global clock, this clock is reset before executeCommand() call to
|
||||||
// reduce the call gettimeofday() system call.
|
// reduce the call gettimeofday() system call.
|
||||||
Timer& wallclock();
|
Timer& wallclock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue