mirror of https://github.com/aria2/aria2
*: make ignoring sleep mode optional
parent
1f458f5a2d
commit
8f6a6484d2
|
@ -221,6 +221,11 @@ 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)) {
|
||||||
|
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||||
|
}
|
||||||
|
#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 +318,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;
|
||||||
|
|
|
@ -738,6 +738,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,
|
||||||
|
|
|
@ -69,11 +69,7 @@ error_code::Value main(int argc, char** argv)
|
||||||
pargv[i] = winArgStrs.back().get();
|
pargv[i] = winArgStrs.back().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
|
||||||
|
|
||||||
Context context(true, winArgc, pargv.get(), KeyVals());
|
Context context(true, winArgc, pargv.get(), KeyVals());
|
||||||
|
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
|
||||||
#else // !__MINGW32__
|
#else // !__MINGW32__
|
||||||
Context context(true, argc, argv, KeyVals());
|
Context context(true, argc, argv, KeyVals());
|
||||||
#endif // !__MINGW32__
|
#endif // !__MINGW32__
|
||||||
|
|
|
@ -335,6 +335,8 @@ 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");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
|
PrefPtr PREF_DISABLE_SLEEP = makePref("disable-sleep-until-finished")
|
||||||
|
// value: true | false
|
||||||
PrefPtr PREF_PAUSE = makePref("pause");
|
PrefPtr PREF_PAUSE = makePref("pause");
|
||||||
// value: default | full | hide
|
// value: default | full | hide
|
||||||
PrefPtr PREF_DOWNLOAD_RESULT = makePref("download-result");
|
PrefPtr PREF_DOWNLOAD_RESULT = makePref("download-result");
|
||||||
|
|
|
@ -288,6 +288,8 @@ extern PrefPtr PREF_STREAM_PIECE_SELECTOR;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
|
extern PrefPtr PREF_TRUNCATE_CONSOLE_READOUT;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
|
extern PrefPtr PREF_DISABLE_SLEEP;
|
||||||
|
// value: true | false
|
||||||
extern PrefPtr PREF_PAUSE;
|
extern PrefPtr PREF_PAUSE;
|
||||||
// value: default | full | hide
|
// value: default | full | hide
|
||||||
extern PrefPtr PREF_DOWNLOAD_RESULT;
|
extern PrefPtr PREF_DOWNLOAD_RESULT;
|
||||||
|
|
|
@ -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