mirror of https://github.com/aria2/aria2
Merge f308192f54
into b519ce04e3
commit
b6d9e4fc6c
|
@ -221,6 +221,12 @@ Context::Context(bool standalone, int argc, char** argv, const KeyVals& options)
|
||||||
if (op->getAsBool(PREF_DISABLE_IPV6)) {
|
if (op->getAsBool(PREF_DISABLE_IPV6)) {
|
||||||
SocketCore::setProtocolFamily(AF_INET);
|
SocketCore::setProtocolFamily(AF_INET);
|
||||||
}
|
}
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (op->getAsBool(PREF_DISABLE_SLEEP)) {
|
||||||
|
if (!SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED))
|
||||||
|
A2_LOG_WARN("--disable-sleep-until-finished: Failed to disable sleep mode.");
|
||||||
|
}
|
||||||
|
#endif // _WIN32
|
||||||
SocketCore::setIpDscp(op->getAsInt(PREF_DSCP));
|
SocketCore::setIpDscp(op->getAsInt(PREF_DSCP));
|
||||||
SocketCore::setSocketRecvBufferSize(
|
SocketCore::setSocketRecvBufferSize(
|
||||||
op->getAsInt(PREF_SOCKET_RECV_BUFFER_SIZE));
|
op->getAsInt(PREF_SOCKET_RECV_BUFFER_SIZE));
|
||||||
|
@ -313,6 +319,11 @@ Context::Context(bool standalone, int argc, char** argv, const KeyVals& options)
|
||||||
reqinfo = std::make_shared<MultiUrlRequestInfo>(std::move(requestGroups),
|
reqinfo = std::make_shared<MultiUrlRequestInfo>(std::move(requestGroups),
|
||||||
op, uriListParser);
|
op, uriListParser);
|
||||||
}
|
}
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (op->getAsBool(PREF_DISABLE_SLEEP)) {
|
||||||
|
SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
|
}
|
||||||
|
#endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::~Context() = default;
|
Context::~Context() = default;
|
||||||
|
|
|
@ -736,6 +736,14 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_ADVANCED);
|
op->addTag(TAG_ADVANCED);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
#if _WIN32
|
||||||
|
{
|
||||||
|
OptionHandler* op(new BooleanOptionHandler(
|
||||||
|
PREF_DISABLE_SLEEP, TEXT_DISABLE_SLEEP, A2_V_FALSE, OptionHandler::OPT_ARG));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
|
#endif // _WIN32
|
||||||
{
|
{
|
||||||
OptionHandler* op(new BooleanOptionHandler(
|
OptionHandler* op(new BooleanOptionHandler(
|
||||||
PREF_RPC_ALLOW_ORIGIN_ALL, TEXT_RPC_ALLOW_ORIGIN_ALL, A2_V_FALSE,
|
PREF_RPC_ALLOW_ORIGIN_ALL, TEXT_RPC_ALLOW_ORIGIN_ALL, A2_V_FALSE,
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
# include <shellapi.h>
|
# include <shellapi.h>
|
||||||
|
# include <winbase.h>
|
||||||
#endif // __MINGW32__
|
#endif // __MINGW32__
|
||||||
|
|
||||||
#include <aria2/aria2.h>
|
#include <aria2/aria2.h>
|
||||||
|
|
|
@ -334,6 +334,10 @@ PrefPtr PREF_SHOW_CONSOLE_READOUT = makePref("show-console-readout");
|
||||||
PrefPtr PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
|
PrefPtr PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
PrefPtr PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
|
PrefPtr PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
|
||||||
|
#ifdef _WIN32
|
||||||
|
// value: true | false
|
||||||
|
PrefPtr PREF_DISABLE_SLEEP = makePref("disable-sleep-until-finished");
|
||||||
|
#endif // _WIN32
|
||||||
// value: true | false
|
// value: true | false
|
||||||
PrefPtr PREF_PAUSE = makePref("pause");
|
PrefPtr PREF_PAUSE = makePref("pause");
|
||||||
// value: default | full | hide
|
// value: default | full | hide
|
||||||
|
|
|
@ -287,6 +287,10 @@ extern PrefPtr PREF_SHOW_CONSOLE_READOUT;
|
||||||
extern PrefPtr PREF_STREAM_PIECE_SELECTOR;
|
extern PrefPtr PREF_STREAM_PIECE_SELECTOR;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
|
extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
|
||||||
|
#ifdef _WIN32
|
||||||
|
// value: true | false
|
||||||
|
extern PrefPtr PREF_DISABLE_SLEEP;
|
||||||
|
#endif // _WIN32
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern PrefPtr PREF_PAUSE;
|
extern PrefPtr PREF_PAUSE;
|
||||||
// value: default | full | hide
|
// value: default | full | hide
|
||||||
|
|
|
@ -884,6 +884,11 @@
|
||||||
#define TEXT_TRUNCATE_CONSOLE_READOUT \
|
#define TEXT_TRUNCATE_CONSOLE_READOUT \
|
||||||
_(" --truncate-console-readout[=true|false] Truncate console readout to fit in\n"\
|
_(" --truncate-console-readout[=true|false] Truncate console readout to fit in\n"\
|
||||||
" a single line.")
|
" a single line.")
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define TEXT_DISABLE_SLEEP \
|
||||||
|
_(" --disable-sleep-until-finished[=true|false] Disables sleep mode on Windows\n" \
|
||||||
|
" until downloads are finished.")
|
||||||
|
#endif // _WIN32
|
||||||
#define TEXT_PAUSE \
|
#define TEXT_PAUSE \
|
||||||
_(" --pause[=true|false] Pause download after added. This option is\n" \
|
_(" --pause[=true|false] Pause download after added. This option is\n" \
|
||||||
" effective only when --enable-rpc=true is given.")
|
" effective only when --enable-rpc=true is given.")
|
||||||
|
|
Loading…
Reference in New Issue