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