mirror of https://github.com/aria2/aria2
make socket parameter in *Command contructor const
parent
e6e0177560
commit
133f759a0d
|
@ -29,7 +29,7 @@
|
|||
#include "SleepCommand.h"
|
||||
#include "prefs.h"
|
||||
|
||||
AbstractCommand::AbstractCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):
|
||||
AbstractCommand::AbstractCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):
|
||||
Command(cuid), req(req), e(e), checkSocketIsReadable(false), checkSocketIsWritable(false) {
|
||||
|
||||
if(s != NULL) {
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
Socket* readCheckTarget;
|
||||
Socket* writeCheckTarget;
|
||||
public:
|
||||
AbstractCommand(int cuid, Request* req, DownloadEngine* e, Socket* s= NULL);
|
||||
AbstractCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s= NULL);
|
||||
virtual ~AbstractCommand();
|
||||
bool execute();
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "InitiateConnectionCommandFactory.h"
|
||||
#include "message.h"
|
||||
|
||||
DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s), lastSize(0) {
|
||||
DownloadCommand::DownloadCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s), lastSize(0) {
|
||||
sw.tv_sec = 0;
|
||||
sw.tv_usec = 0;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
|||
bool prepareForRetry(int wait);
|
||||
bool prepareForNextSegment();
|
||||
public:
|
||||
DownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
DownloadCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
virtual ~DownloadCommand();
|
||||
|
||||
virtual TransferEncoding* getTransferEncoding(string transferEncoding) = 0;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
/* copyright --> */
|
||||
#include "FtpDownloadCommand.h"
|
||||
|
||||
FtpDownloadCommand::FtpDownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* dataSocket, Socket* ctrlSocket):
|
||||
FtpDownloadCommand::FtpDownloadCommand(int cuid, Request* req, DownloadEngine* e, const Socket* dataSocket, const Socket* ctrlSocket):
|
||||
DownloadCommand(cuid, req, e, dataSocket)
|
||||
{
|
||||
this->ctrlSocket = new Socket(*ctrlSocket);
|
||||
|
|
|
@ -28,7 +28,7 @@ class FtpDownloadCommand : public DownloadCommand {
|
|||
private:
|
||||
Socket* ctrlSocket;
|
||||
public:
|
||||
FtpDownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* dataSocket, Socket* ctrlSocket);
|
||||
FtpDownloadCommand(int cuid, Request* req, DownloadEngine* e, const Socket* dataSocket, const Socket* ctrlSocket);
|
||||
~FtpDownloadCommand();
|
||||
|
||||
TransferEncoding* getTransferEncoding(string name);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
|
||||
FtpNegotiationCommand::FtpNegotiationCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):
|
||||
FtpNegotiationCommand::FtpNegotiationCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):
|
||||
AbstractCommand(cuid, req, e, s),
|
||||
dataSocket(NULL), serverSocket(NULL), sequence(SEQ_RECV_GREETING)
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ private:
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
FtpNegotiationCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
FtpNegotiationCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~FtpNegotiationCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "FtpTunnelResponseCommand.h"
|
||||
#include "HttpConnection.h"
|
||||
|
||||
FtpTunnelRequestCommand::FtpTunnelRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
FtpTunnelRequestCommand::FtpTunnelRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
setReadCheckSocket(NULL);
|
||||
setWriteCheckSocket(NULL);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class FtpTunnelRequestCommand : public AbstractCommand {
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
FtpTunnelRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
FtpTunnelRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~FtpTunnelRequestCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "DlRetryEx.h"
|
||||
#include "message.h"
|
||||
|
||||
FtpTunnelResponseCommand::FtpTunnelResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
FtpTunnelResponseCommand::FtpTunnelResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
http = new HttpConnection(cuid, socket, req, e->option, e->logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
FtpTunnelResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
FtpTunnelResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~FtpTunnelResponseCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using namespace std;
|
|||
|
||||
HttpDownloadCommand::HttpDownloadCommand(int cuid, Request* req,
|
||||
DownloadEngine* e,
|
||||
Socket* socket):
|
||||
const Socket* socket):
|
||||
DownloadCommand(cuid, req, e, socket)
|
||||
{
|
||||
ChunkedEncoding* ce = new ChunkedEncoding();
|
||||
|
|
|
@ -37,7 +37,7 @@ class HttpDownloadCommand:public DownloadCommand {
|
|||
private:
|
||||
map<string, TransferEncoding*> transferEncodings;
|
||||
public:
|
||||
HttpDownloadCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
HttpDownloadCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~HttpDownloadCommand();
|
||||
|
||||
TransferEncoding* getTransferEncoding(string transferEncoding);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "HttpConnection.h"
|
||||
#include "HttpProxyResponseCommand.h"
|
||||
|
||||
HttpProxyRequestCommand::HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
HttpProxyRequestCommand::HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
setReadCheckSocket(NULL);
|
||||
setWriteCheckSocket(socket);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class HttpProxyRequestCommand : public AbstractCommand {
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
HttpProxyRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~HttpProxyRequestCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "DlRetryEx.h"
|
||||
#include "message.h"
|
||||
|
||||
HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
HttpProxyResponseCommand::HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
http = new HttpConnection(cuid, socket, req, e->option, e->logger);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
HttpProxyResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~HttpProxyResponseCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "HttpResponseCommand.h"
|
||||
#include "HttpConnection.h"
|
||||
|
||||
HttpRequestCommand::HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
HttpRequestCommand::HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):AbstractCommand(cuid, req, e, s) {
|
||||
setReadCheckSocket(NULL);
|
||||
setWriteCheckSocket(socket);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ protected:
|
|||
bool executeInternal(Segment segment);
|
||||
Command* getNextCommand() const;
|
||||
public:
|
||||
HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
HttpRequestCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~HttpRequestCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
// TODO
|
||||
#include "TorrentDownloadEngine.h"
|
||||
|
||||
HttpResponseCommand::HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s):
|
||||
HttpResponseCommand::HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s):
|
||||
AbstractCommand(cuid, req, e, s) {
|
||||
http = new HttpConnection(cuid, socket, req, e->option, e->logger);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, Socket* s);
|
||||
HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s);
|
||||
~HttpResponseCommand();
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
|
||||
PeerAbstractCommand::PeerAbstractCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, Socket* s):
|
||||
PeerAbstractCommand::PeerAbstractCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, const Socket* s):
|
||||
Command(cuid), e(e), peer(peer), checkSocketIsReadable(false), checkSocketIsWritable(false) {
|
||||
|
||||
if(s != NULL) {
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
Socket* readCheckTarget;
|
||||
Socket* writeCheckTarget;
|
||||
public:
|
||||
PeerAbstractCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, Socket* s = NULL);
|
||||
PeerAbstractCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, const Socket* s = NULL);
|
||||
virtual ~PeerAbstractCommand();
|
||||
bool execute();
|
||||
};
|
||||
|
|
|
@ -64,11 +64,3 @@ bool PeerInitiateConnectionCommand::prepareForRetry(int wait) {
|
|||
e->commands.push(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PeerInitiateConnectionCommand::useProxy() {
|
||||
return e->option->get(PREF_HTTP_PROXY_ENABLED) == V_TRUE;
|
||||
}
|
||||
|
||||
bool PeerInitiateConnectionCommand::useProxyTunnel() {
|
||||
return e->option->get(PREF_HTTP_PROXY_METHOD) == V_TUNNEL;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
#include "PeerAbstractCommand.h"
|
||||
|
||||
class PeerInitiateConnectionCommand : public PeerAbstractCommand {
|
||||
private:
|
||||
bool useProxy();
|
||||
bool useProxyTunnel();
|
||||
protected:
|
||||
bool executeInternal();
|
||||
bool prepareForRetry(int wait);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
PeerInteractionCommand::PeerInteractionCommand(int cuid, Peer* peer,
|
||||
TorrentDownloadEngine* e,
|
||||
Socket* s, int sequence)
|
||||
const Socket* s, int sequence)
|
||||
:PeerAbstractCommand(cuid, peer, e, s), sequence(sequence) {
|
||||
if(sequence == INITIATOR_SEND_HANDSHAKE) {
|
||||
setReadCheckSocket(NULL);
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
void onAbort(Exception* ex);
|
||||
void beforeSocketCheck();
|
||||
public:
|
||||
PeerInteractionCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, Socket* s, int sequence);
|
||||
PeerInteractionCommand(int cuid, Peer* peer, TorrentDownloadEngine* e, const Socket* s, int sequence);
|
||||
~PeerInteractionCommand();
|
||||
|
||||
enum Seq {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
TrackerDownloadCommand::TrackerDownloadCommand(int cuid, Request* req,
|
||||
TorrentDownloadEngine* e,
|
||||
Socket* s)
|
||||
const Socket* s)
|
||||
:AbstractCommand(cuid, req, e, s), len(0) {
|
||||
resSize = 256;
|
||||
res = new char[resSize];
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
protected:
|
||||
bool executeInternal(Segment segment);
|
||||
public:
|
||||
TrackerDownloadCommand(int cuid, Request* req, TorrentDownloadEngine* e, Socket* s);
|
||||
TrackerDownloadCommand(int cuid, Request* req, TorrentDownloadEngine* e, const Socket* s);
|
||||
~TrackerDownloadCommand();
|
||||
|
||||
TransferEncoding* getTransferEncoding(string transferEncoding);
|
||||
|
|
Loading…
Reference in New Issue