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