mirror of https://github.com/aria2/aria2
Added DSCP support
parent
f2fa24b418
commit
924feb12b0
|
@ -730,6 +730,15 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_ADVANCED);
|
op->addTag(TAG_ADVANCED);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
OptionHandler* op(new NumberOptionHandler
|
||||||
|
(PREF_DSCP,
|
||||||
|
TEXT_DSCP,
|
||||||
|
"0",
|
||||||
|
0));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
OptionHandler* op(new BooleanOptionHandler
|
OptionHandler* op(new BooleanOptionHandler
|
||||||
(PREF_SELECT_LEAST_USED_HOST,
|
(PREF_SELECT_LEAST_USED_HOST,
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "prefs.h"
|
#include "prefs.h"
|
||||||
#include "SocketCore.h"
|
#include "SocketCore.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "Option.h"
|
||||||
#include "LogFactory.h"
|
#include "LogFactory.h"
|
||||||
#include "Peer.h"
|
#include "Peer.h"
|
||||||
#include "BtRuntime.h"
|
#include "BtRuntime.h"
|
||||||
|
@ -83,6 +84,7 @@ bool PeerInitiateConnectionCommand::executeInternal() {
|
||||||
createSocket();
|
createSocket();
|
||||||
getSocket()->establishConnection(getPeer()->getIPAddress(),
|
getSocket()->establishConnection(getPeer()->getIPAddress(),
|
||||||
getPeer()->getPort(), false);
|
getPeer()->getPort(), false);
|
||||||
|
getSocket()->setIpDscp(requestGroup_->getOption()->getAsInt(PREF_DSCP));
|
||||||
if(mseHandshakeEnabled_) {
|
if(mseHandshakeEnabled_) {
|
||||||
auto c = make_unique<InitiatorMSEHandshakeCommand>
|
auto c = make_unique<InitiatorMSEHandshakeCommand>
|
||||||
(getCuid(), requestGroup_, getPeer(),
|
(getCuid(), requestGroup_, getPeer(),
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "ReceiverMSEHandshakeCommand.h"
|
#include "ReceiverMSEHandshakeCommand.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "Option.h"
|
||||||
#include "LogFactory.h"
|
#include "LogFactory.h"
|
||||||
#include "SocketCore.h"
|
#include "SocketCore.h"
|
||||||
#include "SimpleRandomizer.h"
|
#include "SimpleRandomizer.h"
|
||||||
|
@ -110,6 +111,7 @@ bool PeerListenCommand::execute() {
|
||||||
std::shared_ptr<SocketCore> peerSocket;
|
std::shared_ptr<SocketCore> peerSocket;
|
||||||
try {
|
try {
|
||||||
peerSocket = socket_->acceptConnection();
|
peerSocket = socket_->acceptConnection();
|
||||||
|
peerSocket->setIpDscp(e_->getOption()->getAsInt(PREF_DSCP));
|
||||||
std::pair<std::string, uint16_t> peerInfo;
|
std::pair<std::string, uint16_t> peerInfo;
|
||||||
peerSocket->getPeerInfo(peerInfo);
|
peerSocket->getPeerInfo(peerInfo);
|
||||||
|
|
||||||
|
|
|
@ -532,6 +532,11 @@ void SocketCore::setTcpNodelay(bool f)
|
||||||
setSockOpt(IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
setSockOpt(IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SocketCore::setIpDscp(int32_t dscp)
|
||||||
|
{
|
||||||
|
setSockOpt(IPPROTO_IP, IP_TOS, &dscp, sizeof(dscp));
|
||||||
|
}
|
||||||
|
|
||||||
void SocketCore::setNonBlockingMode()
|
void SocketCore::setNonBlockingMode()
|
||||||
{
|
{
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
|
@ -120,6 +120,9 @@ public:
|
||||||
// Enables TCP_NODELAY socket option if f == true.
|
// Enables TCP_NODELAY socket option if f == true.
|
||||||
void setTcpNodelay(bool f);
|
void setTcpNodelay(bool f);
|
||||||
|
|
||||||
|
// Set DSCP byte
|
||||||
|
void setIpDscp(int32_t);
|
||||||
|
|
||||||
void create(int family, int protocol = 0);
|
void create(int family, int protocol = 0);
|
||||||
|
|
||||||
void bindWithFamily(uint16_t port, int family, int flags = AI_PASSIVE);
|
void bindWithFamily(uint16_t port, int family, int flags = AI_PASSIVE);
|
||||||
|
|
|
@ -358,6 +358,8 @@ PrefPtr PREF_DISK_CACHE = makePref("disk-cache");
|
||||||
PrefPtr PREF_GID = makePref("gid");
|
PrefPtr PREF_GID = makePref("gid");
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
PrefPtr PREF_SAVE_SESSION_INTERVAL = makePref("save-session-interval");
|
PrefPtr PREF_SAVE_SESSION_INTERVAL = makePref("save-session-interval");
|
||||||
|
// values: 1*digit
|
||||||
|
PrefPtr PREF_DSCP = makePref("dscp");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -294,6 +294,8 @@ extern PrefPtr PREF_DISK_CACHE;
|
||||||
extern PrefPtr PREF_GID;
|
extern PrefPtr PREF_GID;
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
extern PrefPtr PREF_SAVE_SESSION_INTERVAL;
|
extern PrefPtr PREF_SAVE_SESSION_INTERVAL;
|
||||||
|
// values: 1*digit
|
||||||
|
extern PrefPtr PREF_DSCP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -958,3 +958,5 @@
|
||||||
" specified by --save-session option every SEC\n" \
|
" specified by --save-session option every SEC\n" \
|
||||||
" seconds. If 0 is given, file will be saved only\n" \
|
" seconds. If 0 is given, file will be saved only\n" \
|
||||||
" when aria2 exits.")
|
" when aria2 exits.")
|
||||||
|
#define TEXT_DSCP \
|
||||||
|
_(" --dscp=DSCP Set DSCP code")
|
||||||
|
|
Loading…
Reference in New Issue